【发布时间】:2018-06-19 12:16:00
【问题描述】:
Xamarin 构建针对 api 级别 26 的 Android 应用程序崩溃并出现 java.lang.IllegalStateException: Not allowed to start service Intent
在后台收到通知时。
来自Notification in oreo,我的理解是在应用白名单期间只有应用可以提供服务。如何正确处理这种情况,我在收到通知时调用并更新我的数据库,我该如何正确管理。
一个答案显示
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1) {
context.startForegroundService(new Intent(context, ServedService.class));
} else {
context.startService(new Intent(context, ServedService.class));
}
但是我如何在 xamarin 表单应用程序中实现这一点以正确接收推送通知。
【问题讨论】:
-
您想在 Xamarin 表单中实现代码吗?如果是这样,你想在哪里调用它?聚氯乙烯? Android 平台?
标签: android xamarin push-notification xamarin.forms android-8.0-oreo