Cancel notification

Deadly 提交于 2019-12-24 00:52:35

问题


I use Onesignal to push notification and need to cancel all notification of onPause and onResume,

 NotificationManager notificationManager = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
        if (notificationManager!=null)
            notificationManager.cancelAll();

but it's not work correctly. When app restarted I get all old notifications. I restard my app and these old notifications need to not showing. Please help to fix this!!


回答1:


You need to use this method from OneSignal SDK clearOneSignalNotifications

or for only one notifcation cancelNotification.

Check here



来源:https://stackoverflow.com/questions/49111279/cancel-notification

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!