Skip to content Skip to sidebar Skip to footer

Get Location History In Android App?

I need to keep rough track of a users position, but not really in real time. It's sufficient to handle the location updates when the app is started. However, I still need to know w

Solution 1:

However, I still need to know where the user was when the app wasn't running.

That is not possible.

I don't really want to have a service just polling last known location all the time since that would be a waste of battery power.

Then eliminate your requirement for location history. You only get the locations that you request.

Solution 2:

Rough Track can mean you get location of the user (lastKnown or Fresh) after every n-hours. Doing this will not require a service, simply a recurring alarm and receiver will do. In the onReceive method of receiver, you can manage a stack of locations in your app.

You will have to reset the alarm though when the device re-boots. I guess this is an add-on, rest should work fine.

Solution 3:

you can not get current location without running your app... the second way is to make background service ..wich you don't wan't to make...

The other way is to run background service using Alarammanager whenever you want after getting location you can stop the service...like you can make call every hour or 2 times per day...

Post a Comment for "Get Location History In Android App?"