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 907409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:33:03+00:00 2026-05-15T16:33:03+00:00

I am trying to search for best provider with this case below: // GPS

  • 0

I am trying to search for best provider with this case below:

// GPS
    case R.id.main_menu_gps:

        // Set up location services
        mLocationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
        mBestProvider = mLocationManager.getBestProvider(new Criteria(), true);
        Log.d(DEB_TAG, "@@@@Value of mBestProvider is " + mBestProvider);

        if(mBestProvider != null){
            showGpsSearchingDialog();
            mLocationManager.requestLocationUpdates(mBestProvider, 150000, 1, this);
        } else {
            Log.d(DEB_TAG, "Provider is null");
            showGpsAlertDialog();
        }

    break;

My device is returning “GPS” as the best provider but is not able to find a location and my progress dialogue is displayed forever searching. If I go into the phone settings of “Location/Security” and check the “Use wireless networks” the best provider is Network and it works to return a location.

Am I doing something wrong when the best provider is GPS and no data is returned?

  • 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-05-15T16:33:04+00:00Added an answer on May 15, 2026 at 4:33 pm

    If GPS is enabled it will always return GPS as the best provider since you specified an empty criteria. It can take a decently delay for a GPS fix and if you are in a building you may never get a fix at all. So if the network location will be acceptable then you should just do network. Or have a timeout so that at some point you stop waiting on gps and then switch to network instead. If you are using a MapView, you may want to use the MyLocationOverlay because it’s internal logic will handle that for you.

    Your code looks fine btw.

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

Sidebar

Related Questions

I am trying to find out the best way to search/parse a set of
I'm trying to work out the best method to search a vector of type
I am trying to search an XML field within a table, This is not
What is the best way trying to get a text search function using nhibernate?
I'm trying to search for a user's location, my problem is that I want
I'm not sure how to best phrase this, especially while trying to research it.
I am trying to figure out the best data structure to use for this
I'm trying to get this Jquery.parseJson to work without success. <input type=text id=query /><button>search</button><br
I am trying to figure out the best way to parse a search results
I'm trying to get a case-insensitive search with two strings in JavaScript working. Normally

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.