Search code examples
androidandroid-activitylocationmanager

Access LocationManager callbacks from different activities android


I would like to start the LocationManager from one activity where updates are shown in text. But also allow the user to switch to the "map view" activity to see the progress on the map.

How might I go about allowing two separate activities to receive callbacks so I can update both activities?


Solution

  • You could register for updates from a service which would then broadcast to your various activities what the location updates were, allowing multiple activities to see these updates without having to register each one for location updates.