I'm fairly new to android and I'm trying to create a location based app. I'm currently using the LocationManager.GPS_PROVIDER as follows:
Does the LocationManager.GPS_PROVIDER contain the best provider available? I checked the android online documentation for LocationManager and can't seem to find anything definitive on where the value of GPS_PROVIDER comes from. I've noticed that I can manually get the best provider by the following:
Which way to get the provider is considered the correct way?
I was also wondering about how the location update mechanism deals with someone who is moving and passes from one best gps provider to another. For instance if someone is traveling on a train/car that goes a fairly long distance. Is the original requestLocationUpdates updated with the new best gps provider? If not, I suppose the best provider should be checked in onLocationChanged and then a new requestLocationUpdates given.
Thanks for the help...
Code:
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 20000, 1, locationListener);
Code:
Criteria criteria = new Criteria();
bestProvider = locationManager.getBestProvider(criteria, false);
I was also wondering about how the location update mechanism deals with someone who is moving and passes from one best gps provider to another. For instance if someone is traveling on a train/car that goes a fairly long distance. Is the original requestLocationUpdates updated with the new best gps provider? If not, I suppose the best provider should be checked in onLocationChanged and then a new requestLocationUpdates given.
Thanks for the help...