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

  • SEARCH
  • Home
  • 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 3669922
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:18:07+00:00 2026-05-19T02:18:07+00:00

Iam using locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); Criteria criteria = new Criteria(); String bestProvider =

  • 0

Iam using

locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
Criteria criteria = new Criteria();
String bestProvider = locationManager.getBestProvider(criteria, true);
locationManager.requestLocationUpdates(bestProvider, 0, 0, this);
location = locationManager.getLastKnownLocation(bestProvider);

but first time it is not giving location object.Always giving me null.I read in developer.android.com ,

“Cached Location is dismissed if it is
too old”

But second time it is giving location updates.How to solve my problem.

Regards,
Android Developer

  • 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-19T02:18:07+00:00Added an answer on May 19, 2026 at 2:18 am

    There are few options… if getLastKnownLocation() is null because it’s to old you only can wait to get a newer position fix.

    However if you don’t need a very accurate location you can use the networkProvider which is faster.

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

Sidebar

Related Questions

I am using the location service in android's simulator, String provider = locationManager.getBestProvider(criteria, true);
I am using the requestLocationUpdates method of LocationManager to get GPS location updates. I
I still have problem with fetching first location on android. I am using Criteria
I need to obtain coordinates for my application...I am doing this by using LocationManager
I am using LocationManager to get the current location in android.for that ,i have
I have an android application using LocationManager get the cell network location and not
I am using LocationManager to get a single location fix: public class MyActivity extends
I am using the location manager's requestLocationUpdates() method to receive an intent to my
I am very new to this technology so please help me. I am using
iam using AVFoundation Framework to play mp3 file ,everything works great ، i have

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.