Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8511517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:01:03+00:00 2026-06-11T04:01:03+00:00

This is probably a simple/dumb problem. I can’t find any documentation on it. I

  • 0

This is probably a simple/dumb problem. I can’t find any documentation on it.
I want to create my own LocationProvider in Android. LocationProvider is an abstract class, with no constructor.

import android.location.LocationProvider;

public class provider extends LocationProvider {
    public provider() {
    }

    @Override
    public int getAccuracy() {
        // TODO Auto-generated method stub
        return 0;
    }

...

    @Override
    public boolean supportsSpeed() {
        // TODO Auto-generated method stub
        return false;
    }
}

Eclipse gives me the error here:
“Implicit super constructor LocationProvider() is not visible. Must explicitly invoke another constructor“

But of course the empty super constructor is not visible – there are no constructors for LocationProvider. How am I supposed to create a subclass of an abstract class with no constructor?

For example, this throws the same error:

public abstract class topabstractclass {
    private topabstractclass() {
    }
}

class mysubclass extends topabstractclass{
    mysubclass() {      
    }
}

I cannot modify Android’s LocationProvider, so I can’t create a constructor that’s public.
Is this just an intrinsically non-subclassible class? Does android just not expect us to ever create LocationProviders? How are other LocationProviders done? Can anyone provide an example?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T04:01:05+00:00Added an answer on June 11, 2026 at 4:01 am

    You are correct in your assumption. It is impossible to extend an abstract class in which all constructors are private. This means, correctly, that Google does NOT want you extending LocationProvider.

    First, note that other projects may clone LocationProvider. They then create their subclasses of it, and can use them as they see fit.

    Now, I would guess you want to know why LocationProvider is restricted in such a manner. That is explained by the documentation:

    Each provider has a set of criteria under which it may be used; for example, some providers require GPS hardware and visibility to a number of satellites; others require the use of the cellular radio, or access to a specific carrier’s network, or to the internet. They may also have different battery consumption characteristics or monetary costs to the user. The Criteria class allows providers to be selected based on user-specified criteria.

    Here we have to read between the lines a bit. Consider how much of that information comes directly from the carriers and is phone-specific. This means that tampering with it in your app may stop a device from functioning, since its provider is no longer following its esoteric rules. This is why Android sets up all the providers for us. (This link is really handy to keep around. It will show you how to access that location info without your own provider.)

    So, no, you cannot implictly* extend LocationProvider. You must use one that already exists, because they are specially designed to work between the carrier, the hardware, and the software.

    *As shown in @Funtik’s answer, you can extend LocationProvider using a String, ILocationManager signature. However, it’s undocumented, marked with {@hide}, and unsupported in previous versions, so you may have to do some dancing around to get the correct construction method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably a simple answer but I can't find it. I have a
This is probably a really dumb question with a simple answer but... I am
This is probably a simple question but I can't seem to figure out how
This is probably a simple question, but i have been unable to find a
This is probably pretty simple, but I can't figure out how to do it:
This is probably quite simple to do.. but I just can't think of how
This is probably simple, but I can't figure this out: I need regex expression
This is probably something simple, but I can't figure out why I can't get
This is probably really simple, I know you can change css properties with javascript
This is probably simple, but I've tried a few things and couldn't find a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.