I am using FusedLocationProviderClient with pending intent. I am getting the location when the app is active. But while the app goes into background or app is killed, I am getting the location in irregular intervals say 2mins, 3 mins, 10 mins sometimes. Need help with this?
Note : Also I am targeting Oreo.
If you want to get location data while your app is in the background on Oreo or higher, you should run a foreground service (or something similar):
https://github.com/googlesamples/android-play-location/tree/master/LocationUpdatesForegroundService
With Oreo, Google started limiting what apps can do in the background:
https://developer.android.com/about/versions/oreo/background