I have created the application for getting the Users latlong and send them to the server. So, now we have created the Foreground services for the getting the USER's location and is working fine in the All the other devices including the Android OS 9.0.
But in the specific OnePlus 5T Android 9.0 device the foreground service stops working when the device is locked and Service is also terminated after one hour, also even after we have disabled the deep cleaning option there.
Please let us know if there is something with the Device specific config that we need to change for working foreground service continuously.
Reason behind that- Alarm manager
is not calling on time even if you are using setAndAllowWhileIdle()
or setExactAndAllowWhileIdle()
it won't work and pending intent also get destroy, Only High priorities task get executed in system like FCM push notification.
So the solution I found is :- implement push notification in your android application and send data message through push notification and start service from
public void onMessageReceived(RemoteMessage remoteMessage) {
//start your service from this method
}
note :- Check your Force Stop button of that application is enable or disable if its disabled that means system complete killed your application
Android doze-standby mode and idle mode
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With