0

The FusedLocation API is newer than LocationManager API, but it is not clear to me when to use one vs the other. I want to monitor location changes even when the user is not running the app.

I found this nice example using the LocationManager but this is from 2011. Is this information still relevant?

The FusedLocation API examples show how to configure a LocationRequest for continuous location updates in your Activity. My question is, how would you use it to monitor location changes when your Activity is not running?

I've seen other examples that use Alarm Manager, but this is basically polling and seems like overkill and might drain the battery (but maybe I am wrong?).

sidecarcat
  • 482
  • 5
  • 12
  • "might drain the battery" -- monitoring location changes continuously, "even when the user is not running the app", will drain the battery, unless you put reasonable caps on your expectations (e.g., don't worry about the device going to sleep). That being said, with both APIs, you're looking for the methods to request location updates where you provide a `PendingIntent` instead of some listener. – CommonsWare Oct 23 '15 at 21:51
  • @CommonsWare - thanks for pointing out the `PendingIntent` option. I understand this will enable me to send a broadcast or start a service. I'm still learning how to design solutions using these components and need some time to chew on the problem more. – sidecarcat Oct 24 '15 at 15:07

0 Answers0