- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在 android 通知管理器类中有两个函数 cancel() 和 cancelAll() 不管我定义了什么 notifcationManager 因为我仍然无法取消推送的通知。此通知服务在应用程序打开时启动的后台服务中运行。
@Override
public void onNotificationPosted(StatusBarNotification sbn){
Context context = this;
HushNotification notif = new HushNotification(sbn);
NotificationManager notificationManager = (NotificationManager)
getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
//this does not properly cancel the notifications posted
notificationManager.cancelAll();
} ```
最佳答案
将代码放在 onCreate 方法中:
NotificationManager notificationManager = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancelAll();
关于java - cancel() 或 cancelAll() 不取消来自应用程序的通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54269295/
在下面的代码中,在 CancelAll 和 Stop 之后,之后添加到队列中的请求将在启动命令之后立即执行。 如何删除插入队列中的最后一个/多个请求? final RequestQueue
我已经面临这个问题很长时间了,我有一个具有很多功能的应用程序,其中之一就是闹钟 我的通知只是停留在那里,永远不会消失尽管我正在打电话cancelAll()/cancel()从通知管理器,我也有 aut
在 android 通知管理器类中有两个函数 cancel() 和 cancelAll() 不管我定义了什么 notifcationManager 因为我仍然无法取消推送的通知。此通知服务在应用程序打
我有 Cordova 应用程序,带有本地通知插件。问题是 cancelAll() 不会等到它完成,因此当我添加新消息时它仍在删除。 如何同步线程以使 cancelAll() 等待? 一些相关代码Ala
您好,我在我的 android 项目中使用了 phonegap 本地通知插件。通知效果很好。我可以删除带有 ID 的通知但在我的应用程序中,我必须删除所有通知选项,为此插件提供了取消所有通知的方法。这
使用 NotificationManagerCompat 取消所有通知。 NotificationManagerCompat manager = NotificationManagerCom
我正在使用 Delphi DX Seattle 并在 Android 设备上进行测试 当用户单击按钮时,我正在创建多个计划通知 当用户单击另一个按钮时,我会清除剩余的通知 我似乎无法让 TNotifi
这是我的 onComplete。 $('#fine-uploader-house').fineUploader({ ... }).on('complete', function(event, id,
我是一名优秀的程序员,十分优秀!