I have a foreground service to detect activity recognition changes, but looks the service sometimes going to sleep or something similar and that’s why not working correctly. I added a “ping” log:
override fun onCreate() {
super.onCreate()
while (true) {
delay(60_000)
Log.d("Service", "Running")
}
}
And somitemes has more minutes between 2 ping, but later it’s coming in every 60 seconds.
2024.07.29 21:27:40.16 – Running (428s)
2024.07.29 21:32:11.16 – Running (271s)
2024.07.29 21:34:36.16 – Running (144s)
2024.07.29 21:35:36.16 – Running
2024.07.29 21:36:37.16 – Running
2024.07.29 21:37:37.16 – Running
2024.07.29 21:38:37.16 – Running
2024.07.29 21:39:37.16 – Running
2024.07.29 21:40:37.16 – Running
2024.07.29 21:41:37.16 – Running
How can it be? How can I stabilize it? No battery saving mode or something similar
isPowerSaveMode: false
isDeviceLightIdleMode: true
isDeviceIdleMode: false
locationPowerSaveMode: 0
isLowPowerStandbyEnabled: false