android - 除带有彩色操作系统的 OPPO 外,服务在所有手机上都能正常工作。在 oppo 中,服务会持续运行一段时间,但随后停止工作。有什么解决方案吗?
问题描述
public class MainService extends Service {
@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}
public int onStartCommand(Intent intent, int flags, int startId){
// handleCommand(intent);
return START_STICKY;
}
public void onCreate() {
super.onCreate();
new CaptureLocation(MainService.this);
new GenerateStamp(MainService.this);
new DistanceCompute(MainService.this);
new GenerateStamps2(MainService.this);
new GenerateACDC(MainService.this);
}
}
这是我为 android 编写的 java 代码,因为我们知道 android 服务在后台运行很长时间,并且它在所有 android 手机上运行良好,即联想、三星、红米、LYF water Jio 等,除了 Oppo。我已经启用它自动启动,仍然无法正常工作。
解决方案
电池->其他应用程序->应用程序->在后台时Disa Freez
推荐阅读
- modelica - 在 JModelica 中未正确调用 c 函数
- bash - 连接第一列中匹配值的第二列行并生成文件
- intellij-idea - 将 IntelliJ 插件放在状态栏中
- java - 在请求目标中发现无效字符。上传文件时,有效字符在 RFC 7230 和 RFC 3986 中定义
- windows - 如何在 PostgreSQL 上进行转储?
- list - 如何从结构中获取列表?
- python - 哪个是写出python错误的更好方法
- javascript - Parse-Server:无键查询
- vba - VBA 后期绑定删除 Outlook 签名
- php - 使用 Herdoc 时格式化多个表