I want to monitor a user's location on a regular basis, like Google Latitude does. Something that would wake the phone up every X minutes, even if the app is currently not running, get the location, and send it to a server. This is something that the user will have to opt into.
Using LocationManager alone does not seem to be the way to go. I guess this is sort of a follow up question to this one: LocationManager updates every minute, consuming a lot of battery power
It seems like using a combination of AlarmManager and LocationManager would work.
What is the best way to do this?
Conclusion. Enabling GPS uses zero extra power except when location services are actually being used. You'll use more power turning it on and off than just leaving it on all the time. There is no point in keeping your GPS on if you aren't using any app that utilizes it.
Open the Find My app and choose the People tab. Select Start Sharing Location. Enter the name or number of the person you want to share your location with and tap Send. Select how for long you want to share your location, and tap OK.
I've tried just using LocationManager
for this and did not have much luck. Hence, I rolled a LocationPoller
that, in conjunction with your own _WAKEUP
alarms, should handle this scenario.
Have you looked into writing a service to handle this?
I would be a bit concerned about battery life though, so I'd make the 'X' configurable, if that's appropriate
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With