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.
Asked
Active
Viewed 58 times
0

Md. Sabbir Ahmed
- 850
- 8
- 22

Minhaj Nadeem
- 56
- 5
-
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 Answers
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