我创建了一个应用程序,我想在点击特定按钮后,在通知栏上显示“永久通知”。我搜索它并使用以下代码:
NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
.setSmallIcon(R.mipmap.ic_clip_board_service)
.setContentTitle(getResources().getString(R.string.notifTitle))
.setContentText(getResources().getString(R.string.notifText))
.setOngoing(true);
正在进行的方法,防止用户手动清除notification.in我的模拟器(Genymotion),在我的真实手机(华为G8)中一切都是ok.but当我试图删除通知时,一个弹出菜单出现并说:
不推荐
删除正在进行的通知可能会影响应用程序稳定性。
菜单上已经有两个按钮:cancel和Remove.and I can remove the notification。:(我不想让用户手动删除通知。我的手机或setOngoing(真)方法有问题吗?先谢谢你...
发布于 2018-01-04 17:02:24
根据我在我的应用上看到的类似情况,华为手机似乎总是允许清除通知和关闭应用。我的应用程序甚至以设备管理员的身份运行,它仍然可以被清除。
https://stackoverflow.com/questions/41127458
复制相似问题