Hello folks, I am developing a Service that uses location information. I want it to always use the "best" enabled LocationProvider according to a given Criteria object. For this I initially use the following method:
LocationManager.getBestProvider(Criteria criteria, boolean enabledOnly) with enabledOnly set to "true", and I then register my LocationListener with the result. My question is the following: how do I know when new providers become available in order to re-invoke getBestProvider()? I have come up with two solutions, neither of which seem satisfactory: 1) Register a listener for all available providers, whether or not they are enabled, and override the onProviderDisabled, onProviderEnabled and onStatusChanged methods. But then the listener also gets unnecessary calls to onLocationChanged which I don't want to happen due to performance/battery constraints. 2) Run a background thread which periodically invokes LocationManager.getBestProvider and checks if there are any changes. Again this seems like an unnecessary overhead. Is there a better approach that I am overlooking? Any suggestions would be much appreciated. Thanks, Michael. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

