Efficient background service for tracking user location

I am developing a small Android application in which I want to have Geolocation functionality. What I want to encode is one service that gives the updated location of the user, regardless of whether it uses my application or not.

I know that if I constantly check the user's location, he will drain the battery of the device, so I want a good solution for this. For example, to give me updates every 5 or 10 minutes. I read a lot about this question, but I wanted to get one good solution.

I read this page and it is a good solution if the user is using my application, but if the user is not using my application, then what should I do? How to solve this problem?

+5
source share
1 answer

I previously developed such an application. In relation to your requirement, you will need the following Android APIs.

  • Location (for Lat-lon information)
  • AlarmManager (to schedule an event to regularly receive detailed data and upload data to a remote server)
  • Http (API for sending detailed information to a remote server)
  • Android service (allows you to work in the background)
  • BroadcastReceiver (, )
+10

All Articles