0

In my application I am using .requestLocationUpdates() method of the LocationClient Class to request for location every 5 seconds. Once a location update is received it will call onLocationChanged method in which I am creating a new AsyncTask to upload the location data to a web server.

The problem is I am doing all this in the main UI thread, so the upload stops when app pauses. I am thinking to request for location updates in a new service, but I have a doubt in mind :

Does .requestLocationUpdates() methods creates its own service ? Do I really need to create a service myself or .requestLocationUpdates() method will do it for me ?

Rakesh
  • 1,133
  • 4
  • 13
  • 28

1 Answers1

0

If you want to keep running your ".requestLocationUpdates()" when the app is paused, you have to use a Service with "START_STICKY" flag. And I think yes, ".requestLocationUpdate()" methods creates its own service or its own thread, but you don't have any access to this.

Cocorico
  • 1,998
  • 1
  • 22
  • 38