Reputation: 1313
I am really amazed about this location aware system in android and not getting the consistent way to send periodic information to the server continuously. I wanted the application to be continuously running without fail even if the device is not switched off for month too. The problems I am facing are:
What might be the most recommended approaches? Currently I am creating a service to listen for location update on onCreate()
method & send those data to server on onStartCommand()
method. I have registered AlarmManager()
from within service itself for 15 minutes periodicity to send location info...?
Upvotes: 2
Views: 1682
Reputation: 7467
The Android OS can kill a process at any time due to memory needs or other issues, so you have no guarantees that your process will continue to run. For similar reasons (limited resources on mobile devices), location services are optimized to reduce power consumption. One of these optimizations is to not provide location updates if you're not moving.
For a recommended approach, I'd go with this guy:
http://android-developers.blogspot.com/2011/06/deep-dive-into-location.html
Upvotes: 3