Location Tracking, Doze, AppStandby

532 Views Asked by At

I've implemented Background Location Tracking using IntentService. I'm able to receive Location points in Foreground Mode. But when a device is locked or after some time app killed, I'm not able to receive location points. How can I handle Doze & AppStandby while tracking the location of a device in the background?

I don't want to run foreground service all the time. Any solution for Background Continuous Location Tracking with handling Doze and AppStandby?

2

There are 2 best solutions below

2
On

If you are using fusedLocationClient API as given in this link then i request you to change your dependencies use Google play services as they provide more feasible and accurate location than fusedLocation API's by android. you can refer the documentation Here and also they provide a solution for your problem using background location tracking

1
On

You can implement custom locationlistener or FusedLocationProviderApi (fused link) as per fused documentation

The fused location provider manages the underlying location technologies, such as GPS and Wi-Fi.

I implemented the scenario that's not approximately same to yours but in that I had condition to pick targeted location if internet is not available so, i implemented my own Listener that you can find from (here) which is connected to the Bind Service.

You also have to implement the location listener with the use of background service. and for the doze you can programmatically turn it off for this app procedure.