【发布时间】:2018-09-18 09:59:17
【问题描述】:
我在我的 Activity 的 onResume 上启动了一项服务,它在 oreo 上运行良好,但最近我看到 Android P 的崩溃,上面写着“无法恢复 Activity...。不允许启动服务意图...应用程序是在后台......”。有没有人以前见过这个并且能够应用修复,任何输入将不胜感激。
@Override
public void onResume() {
super.onResume();
Timber.v("onResume");
Intent intent = new Intent(context, Token.class);
intent.setAction(ACTION_FETCH_TOKEN);
context.startService(intent);
}
只是为了添加更多上下文,我自己无法重现崩溃。
【问题讨论】:
-
包含您的代码。
-
代码很简单
-
受保护的无效 onResume() { super.onResume(); context.startService(intent); }
-
编辑您的问题以包含代码。
intent声明在哪里? -
看看这个问题和第一个答案:stackoverflow.com/questions/49961273/…
标签: android