首页 > 解决方案 > 除带有彩色操作系统的 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。我已经启用它自动启动,仍然无法正常工作。

标签: androidmultithreadingrunnable

解决方案


电池->其他应用程序->应用程序->在后台时Disa Freez


推荐阅读