OneSignal / OneSignal-Cordova-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Ionic, PhoneGap CLI, PhoneGap Build, Cordova, or Sencha Touch app with OneSignal. Supports Android, iOS, and Amazon's Fire OS platforms. https://onesignal.com
Other
251 stars 198 forks source link

Clearing notifications documentation #730

Open epetre opened 3 years ago

epetre commented 3 years ago

Description: I have 3 questions which I can't seem to find an answer to while looking at the documentation:

1. Why can't we clear notifications in iOS? I noticed that we can clear all notifications and notifications by id in Android, but it's mentioned it's only available for Android. What would be the recommended way to deal with this for iOS devices? Is there a good reason that it's not part of the SDK?

https://github.com/OneSignal/OneSignal-Cordova-SDK/blob/0c873a9115e8732e2040e9531470bfcbfbd49ae4/www/OneSignalPlugin.js#L188

I have read the docs and can't make sense of it, but after testing iOS I realized that all pushes are automatically cleared when tapping one of them.

Am I missing something?

  1. Android seems to require either the notificatin ID or group ID to clear notifications unless we want to clear them all, is that the Android ID and android group id (the channels?) ?

  2. Is there a way to get a list of all the notifications in the tray? It would be nice to clear a notification from the tray if a user goes directly in the app to the content they needed to see and we'd be able to clear that push for them.

athouary commented 2 years ago

Thanks for this post. Any news about the questions? These notification management use cases are quite important to handle, in my opinion...

after testing iOS I realized that all pushes are automatically cleared when tapping one of them.

@epetre, I tried it on a iOS 15.3 device, and opening a notification won't clear the other ones automatically. Is the behavior you describe related to the unsubscribeWhenNotificationsAreDisabled function?

Did you manage to clear iOS notifications at all?

Have you found any answer to your questions 2. and 3.?