Reputation: 623
my gps location provider takes at least one minute to be available. I took best provider, and it is "gps". What will be the reason for that? My code is given below..
locationListener = new LocationListen();
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
String provider = locationManager.getBestProvider(criteria, true);
if(provider == null){
provider = LocationManager.GPS_PROVIDER;
}
if(!locationManager.isProviderEnabled(provider)){
locationManager.setTestProviderEnabled(provider, true);
}
boolean enabled = locationManager.isProviderEnabled(provider);
if(enabled){
System.out.println("provider enabled");
// setAlert("provider enabled", "", false);
}else{
System.out.println("provider disabled");
// setAlert("provider disabled", "", false);
}
locationManager.removeUpdates(locationListener);
locationManager.requestLocationUpdates(provider, (long)1000, (float)0, locationListener);
onStatusChanged() method is called only after atleast a minute and changed status is the provider availability (available) after this onLoctionChanged() method is called. What will be the reason for delayed availability of gps location provider?
Upvotes: 0
Views: 1092
Reputation: 26874
you seem to be missing some GPS theory. The first time you start the GPS device ("cold boot"), it must scan for satellites and get a lock on them before being able to determine the device's position.
While AGPS or ephemeryds update, the first only if supported by network, decreases fix time, it usually takes from 10 seconds to 2 minutes to get a fix, depending on weather conditions, buildings, etc.
It's a hardware limitation. Try to compare your fix time with an Android car navigator software in open country with clear sky, I believe you won't find much differences. But I still believe it will take lesser in those conditions.
One minute is ususally acceptable as GPS fix time.
Upvotes: 2