How to get CurrentLocation from GPS FirstTime quickly?
Posted
by
Are
on Stack Overflow
See other posts from Stack Overflow
or by Are
Published on 2011-01-04T06:52:17Z
Indexed on
2011/01/04
6:53 UTC
Read the original article
Hit count: 226
android
Hi,
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
© Stack Overflow or respective owner