Question

you can subscribe to requestLocationUpdates via two ways

  • one by specifing a PendingIntent
  • the other is by using a LocationListener

When is advised the one and when the other?

Was it helpful?

Solution

If the component needing location updates only needs updates when the component is around -- say, an activity -- I'd use the LocationListener approach.

If the component needing location updates specifically will not be around -- say, an IntentService -- I'd use the PendingIntent. You can't use the LocationListener in this case, since there is nothing in memory to be listening for locations.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top