Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No services are working on One plus 5T OS android OS 9.0

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.

like image 952
Kishan sharma Avatar asked Feb 08 '19 05:02

Kishan sharma


1 Answers

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

like image 123
Ronil Raut Avatar answered Nov 07 '22 12:11

Ronil Raut