-1

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?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Boris Rozhkovsky
  • 565
  • 1
  • 6
  • 17

2 Answers2

1

You can use LocationListener. google location listner

Saranya Subramanian
  • 417
  • 1
  • 5
  • 19
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