I'm sending my coordinates to my server every 10meters so i can track myself.
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, time, meters, locationListener);
this works fine i get my coordinates. However i'm worried that after a while the phone will shutdown the app and my locationListener will stop? Is there a way to ensure that my app will keep listening for locationupdates?
Create a
Service
to keep track of your locationchanges, and inonStartCommand
you can returnSTART_STICKY
to keep theService
alive until you stop it.Example: http://developer.android.com/reference/android/app/Service.html#LocalServiceSample