Im using Ionic React and Capacitor. I have push notifications working which is good, and the badge count reflects any new notifications received by the device. However, I want to clear the App badge when user enters the App. I couldn’t find a Capacitor plugin for this, so tried to use the react native Badge plugin, but when installing:
ionic cordova plugin add cordova-plugin-badge
I get error message:
Cordova is not supported for react projects
Not sure how to fix my problem. I thought capacitor would have this plugin covered as must be a popular request. But im probably missing a trick.
Is there another way to reset the badge. Any ideas would be greatly appreciated.
If anyone else needs this solution … as @mikeroberts suggested, I simply called
PushNotifications.removeAllDeliveredNotifications();
in the appropriate place within my Ionic React App.
Hi @Arains, yeah thats the documentation I used. Only tried for iOS so far but works fine. The only thing I would recommend additionally if you want to target a specific user device is the following plugin
The reason being, this provides you with the FCM token instead of the APN token returned by Capacitor, which can then be used to send push notifications to a specific device
Hope it helps.
Cheers
Probably a stupid question - since IOS 13.3 not getting badge notifications (though push are working fine). Is this a straightforward plugin or is it an issue with IOS 13.3?