从最近删除应用程序时停止后台服务 [英] Background Service Stop when removing app from recent

查看:45
本文介绍了从最近删除应用程序时停止后台服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

后台服务停止,当我在 oppo & 中从最近删除我的应用程序时vivo手机,&在这种情况下,广播接收器也不起作用.

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

推荐答案

我在 Oppo、Vivo、Mi 等手机上遇到了同样的问题,

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

  1. 从最近的应用程序中删除后,应用程序被杀死,甚至服务也被杀死

解决方案:我在我的应用程序中添加了自动启动权限,例如 this 并且它起作用了.

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

  1. 解决此问题后,由于 DOZE 模式,我的应用程序在后台运行一段时间后被冻结/终止解决方案:对于这种情况这个有效,现在我的应用程序在任何设备的后台运行

  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

完成以上操作后:

intent.setClassName("com.coloros.oppoguardelf", "com.coloros.powermanager.fuelgaue.PowerConsumptionActivity");开始活动(意图);

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

调用上述意图,它会将您重定向到电池选项,禁用后台冻结,异常应用优化和打盹从\节能器->youAPP"

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.

这篇关于从最近删除应用程序时停止后台服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆