0

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?

Benny
  • 677
  • 1
  • 6
  • 22

1 Answers1

0

Create a Service to keep track of your locationchanges, and in onStartCommand you can return START_STICKY to keep the Service alive until you stop it.

Example: http://developer.android.com/reference/android/app/Service.html#LocalServiceSample

Carnal
  • 21,744
  • 6
  • 60
  • 75