【发布时间】:2021-09-28 13:36:49
【问题描述】:
我在后台服务运行时创建了通知通道
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel channel = new NotificationChannel(channelId,
"Channel for notification",
NotificationManager.IMPORTANCE_NONE);
mNotificationManager.createNotificationChannel(channel);
}
在onDestroy 函数中,我通过传递相同的频道名称调用以下方法来删除通知:
notificationManager.deleteNotificationChannel(channelId);
当我尝试在某些运行 Android 10 和 11 的设备上删除该通知时,得到了 SecurityException
【问题讨论】:
标签: java android notifications android-notifications android-backup-service