在我的 android 应用程序中,我正在运行一个在前台启动的远程服务
startForeground(1, notification)
以免它被杀死。在此服务中,允许像这样每 15 分钟运行一次任务并重复。
handler.post(scheduledTask);
class ScheduledTask implements Runnable{
@Override
public void run() {
// Do the task
// Repeat the task after the interval
handler.postDelayed(this,INTERVAL);
}
}
我把这个应用程序保留了一天。但是在午夜之后,它停止了大约 5-6 个小时的工作,然后当我恢复应用程序时,它还在继续。
有人能告诉我是什么导致了这个问题吗?我在 Galaxy Note 中对此进行了测试。