2

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 Answers1

2

You need to use this method from OneSignal SDK clearOneSignalNotifications

or for only one notifcation cancelNotification.

Check here

extmkv
  • 1,991
  • 1
  • 18
  • 36