-
Notifications
You must be signed in to change notification settings - Fork 1.9k
clearAllNotifications not working on iOS #1080
Comments
@purinagripal what version of the plugin are you using? |
plugin version is 1.6.2, I realized that this version not include the clearAllNotifications function! I try using a newer version Thanks |
I try with the last version of this plugin 1.7.4 (cordova cli-6.1.0) and I still have the notifications on the notification center... Is the next code the right way to use clearAllNotifications???
|
Is the notification event being fired in first place? Is your app in foreground, background or fully closed? |
I open the app tapping a notification from notification center and the notification event is fired. But the rest of notifications stay in the notification center |
@purinagripal and by |
Yes I know it, but I sent a few notifications and when I tap one and the notification event is fired I would like to clear the rest of notification from my app, but it not work... :( |
I've been testing and I've been able to reproduce it a few times, but other times it´s working fine, really strange. You can also try to set the badge to a value and then to 0
You can also use ios.clearBadge true on the init method
|
Just found the problem, you have to pass a success callback function, if you open the app on safari remote web inspector to debug it you should see this message:
So you only have to do this and it will work: But probably the clearBadge: 'true' option on the init method should be a better option in your case. @macdonst, does it makes sense to force the use a success function in this case? |
Thank you @jcesarmobile , I'm going to try this way. Thank you very much! |
I try with push.clearAllNotifications(function(){}); but still not working. Now I'm trying clearBadge: "true"... |
Still not working |
Are you sure you updated the plugin correctly? the 3 ways I told you are working fine for me |
@jcesarmobile I'll make a change so the success callback is no longer mandatory. |
Pushed the change, will be in next point release. |
I'm using Phonegap Build and checking the log for the iOS build and I can read the next: Fetching plugin "[email protected]" via npm So I supose the plugin is updated. |
@jcesarmobile how can I open my app on safari remote web inspector to debug it?? I'm starting debug in iOS and I don't know tools for that... |
I'm testing with success function handler and error function handler and they are not fired...
|
When the app is foreground and the notification event is fired, the successHandler function for clearAllNotifications is fired too |
Using setTimeout I get the message from the successHandler function but notifications still on notification center (only the one that I tap disapear)
Maybe something necesary in config.xml??? |
Tested with with v1.7.4, this is my observation:
Here's the code I used ( document.addEventListener('resume', () => {
// --- #1 works!
if (this._plugin) {
this._plugin.setApplicationIconBadgeNumber(
() => this._log('Push notifications cleared'),
() => this._log('Error clearing push notifications')
, 0);
}
// --- #2 does not work (on Samsung - Android API 21)
this._plugin.clearAllNotifications(
() => this._log('Push notifications cleared'),
() => this._log('Error clearing push notifications')
);
}); |
The issue was about clearing the notifications on iOS notification center, if you are having problems with android open a new issue. |
I had the same issue with
and it did the trick. It may be relevant that I don't use the badge number elsewhere in my app. I noticed that all |
I am using plugin version 1.9.2 but still not working on ios. iOS - 10.0.2 config : push.clearAllNotifications(function () { In debug mode console.log output >> All system notification removed, but ios notification not cleared. |
Hi all, I'm having the same issue on plugin v2.0.0 using Cordova iOS 4.4.0. The only way to clear all notifications from notification center is to use the workaround suggested by @slackernrrd, that is setting the badge to 1 and then back to 0. Obviously that is not ideal if you want to use the badge in your app. On Android the issue is not present, clearAllNotifications() works perfectly. I'm wondering why this issue has been closed... |
This thread has been automatically locked. |
Expected Behaviour
When the notification event is fired clear the notifications in the notification center.
Actual Behaviour
Notifications stay in the notification center.
Reproduce Scenario (including but not limited to)
Steps to Reproduce
Platform and Version (eg. Android 5.0 or iOS 9.2.1)
iOS 9.3.2
(Android) What device vendor (e.g. Samsung, HTC, Sony...)
iPad 4
Cordova CLI version and cordova platform version
Plugin version
Sample Push Data Payload
$body['aps'] = array(
'alert' => 'mensaje de ejemplo',
'sound' => 'default'
);
Sample Code that illustrates the problem
Logs taken while reproducing problem
The text was updated successfully, but these errors were encountered: