How to listen for location updates from multiple providers?
-
29-09-2019 - |
Question
In this code I request location updates from GPS
locMan.requestLocationUpdates(LocationManager.GPS_PROVIDER,20000, 1, gpsListener);
But how can I make sure it listens for Wifi or Cell ID updates too?
Solution
You should be able to call requestLocationUpdates()
, with distinct LocationListener
objects, for the other providers.
OTHER TIPS
Actually, you can share the same listener. Just user Location.getProvider() in the listener to find out which provider generated the update.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow