Search code examples
androidperformancegpsproximitybattery

proximity alert and battery drain


I'm working on a project where I track the position of the phone every 5 minutes using the requestSingleUpdate method. Doing this the phone's battery last all day long.

I want to check if the phone is going close to special locations that I've geocoded. I had in mind to use proximity alert, but I don't know exactly how it works. Will it only use the location provided by my previous requestSingleUpdate or will it set its own requestLocationUpdates ?

And what about the battery consumption ?


Solution

  • From the Android Documentation it will use it's own method of checking location and will do it every 4 mins when the screen is off.

    So you don't need to use your own locationListener, If you did want to get the users location for other means. Use the PASSIVE_PROVIDER (as of API8) that way when ever the proximityAlert does a location request or ANY other app that uses the LocationManager triggers a request, the PASSIVE_PROVIDER will also be triggered.