How to listen for location updates from multiple providers?
In this code I request location updates from GPS
locMan.requestLocationUpd开发者_开发问答ates(LocationManager.GPS_PROVIDER,20000, 1, gpsListener);
But how can I make sure it listens for Wifi or Cell ID updates too?
Actually, you can share the same listener. Just user Location.getProvider() in the listener to find out which provider generated the update.
You should be able to call requestLocationUpdates()
, with distinct LocationListener
objects, for the other providers.
精彩评论