原因可以在哪里写了执行完成后就自动结束的吧 导致前台服务没有出现

如我

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
Log.d("MyService", "onStartCommand executed");
new Thread(new Runnable() {
@Override
public void run() {
//处理具体的逻辑
stopSelf();
}
}).start();
return super.onStartCommand(intent, flags, startId);
}

写了个stopSelf();

相关文章:

  • 2022-02-05
  • 2022-01-06
  • 2022-03-10
  • 2021-07-03
  • 2022-12-23
  • 2022-01-12
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2021-12-28
  • 2021-08-16
相关资源
相似解决方案