I have an app that tracks user location continously. Now, this works as follows: I have foreground service that schedules repeating alarm via AlarmManager. Alarm Receiver in onReceive method starts service again. Inside service Im receiving current location from Locator (singleton class that gets location form GP Services). Alarm manager fires alarm once in a 12 minutes, and I want to set repeating time to 1 minute or less. But i`m aware of too frequenlty waking up device - I think it will consump battery very fast. This foreground service works always. Are there any other, better way to track location continously?
Asked
Active
Viewed 46 times
-1
-
https://stackoverflow.com/questions/14478179/background-service-with-location-listener-in-android – Jackey kabra Nov 30 '17 at 14:02
2 Answers
0
Checkout answer on this thread: Getting location
In above answer, while creating object for LocationRequest call these two methods, setFastestInterval(long interval)
and setInterval(long interval)
which will fetch location after some interval.

Shrikant
- 579
- 1
- 5
- 21