我们调整了我们对Oreo的持续通知,并且效果很好.现在,仅在Pie上(在Oreo设备上没有发生),我们得到了标题错误.Pie中的前台服务有什么变化我错过了吗?
这是前台服务的onCreate代码 - >
override fun onCreate() {
super.onCreate()
val notification: Notification = NotificationCompat.Builder(this, packageName)
.setSmallIcon(R.drawable.status_notification_icon)
.setContentTitle(getString(R.string.ongoing_notify_temp_title))
.setContentText(getString(R.string.ongoing_notify_temp_message))
.setGroup(AppConstants.NOTIFICATION_GROUP_ONGOING)
.setColor(ContextCompat.getColor(this, R.color.custom_blue))
.build()
startForeground(ONGOING_NOTIFY_ID, notification)
appSettings = AppSettings(this)
weatherLookUpHelper = WeatherLookUpHelper()
MyRoomDatabase.getInstance().invalidationTracker.addObserver(onChange)
retrieveCurrentLocation()
createAlarmManager()
}
如您所见,我们只是创建通知然后调用startForeground.关于为什么这段代码会产生标题错误的任何想法?
侧注:Fabric Crashlytics显示此崩溃仅发生在运行Pie的像素设备(像素,像素xl,像素2,像素2 xl)上
编辑:我们的清单中有前台权限