0

I request location updates using fusedLocationProviderClient.requestLocationUpdates() in onStartCommand(). It works fine. But when I close the app or kill the app, onLocationResult() is not called.

Md. Sabbir Ahmed
  • 850
  • 8
  • 22
  • Already had an answer [enter link description here](https://stackoverflow.com/questions/15066540/android-location-updates-in-a-service) – Moklesur Rahman Mar 18 '19 at 07:48

1 Answers1

0

You need to use a ForegroundService. Here's the complete code for doing exactly what you want:

https://github.com/googlesamples/android-play-location/tree/master/LocationUpdatesForegroundService

Gavin Wright
  • 3,124
  • 3
  • 14
  • 35