I am using Fused Location Provider Client and Location Request on an android app to send the phone's location every 5 seconds. However, I stop getting location updates when the device is asleep. I want the ability to do this even when the device is asleep. Does anyone have any suggestions? Do I need to create a Foreground Service?
Asked
Active
Viewed 44 times
1
-
"I am using Fused Location Provider Client and Location Request on an android app to send the phone's location every 5 seconds" -- from a battery consumption standpoint, this is *dreadful*, which is why Google and device manufacturers try to minimize the impact. "I stop getting location updates when the device is asleep" -- Doze mode, app standby, and manufacturer-specific battery-saving solutions are going to interfere with what you want. – CommonsWare Dec 08 '21 at 17:43
-
I understand this is dreadful for battery life. However, this is something that is needed for the task. This is a utility app used to track personnel on a job site, so it only needs to last a few hours before recharge. – pilotman Dec 08 '21 at 21:10