Search code examples
androidbroadcastreceiverandroid-broadcastbackground-serviceoppo

Background Service Stop when removing app from recent


Background service is stop, when removing my app from recent in oppo & vivo mobiles, & Broadcast reciever also not working in that case.


Solution

  • I had same issue with Oppo, Vivo, Mi and etc phones,

    1. after removing from recent applications app was getting killed even services was getting killed

    Solution: I had add autostart permissions like this in my application and it worked.

    1. After resolving this issue my app was getting frozen/killed after sometime running in background due to DOZE mode Solution: for this condition this worked and now my app is working in background in any device

    2. After above things do this:

    intent.setClassName("com.coloros.oppoguardelf", "com.coloros.powermanager.fuelgaue.PowerConsumptionActivity"); startActivity(intent);

    call above intent, it will redirect you to battery option, "Disable Background Freeze, Abnormal Apps Optimization and Doze from \"Energy Saver ->youAPP"

    Note: Once you call above intent, there you may get different options to turn off Battery saving options.