I’m trying to update the notification count to 0 once the app is opened but I couldn’t find any relevant methods to update the badge count in @react-native-firebase/messaging package. Is there any possible way to update the notification count inside the app?
This is my listener
messaging().onNotificationOpenedApp(async (remoteMessage) => {
console.log(remoteMessage);
})
Are there any methods provided by rnfirebase package to set the badge count inside the app? If there then that would be a great help 😊
2
Answers
I've used the below package to solve this problem
Here's the code for it,
This will reset the badge count to 0 once you open the app, You can also set the count as you want dynamically and it will get updated.
import firebase from ‘react-native-firebase’;
using code:
firebase.notifications().removeAllDeliveredNotifications();
or:
firebase.notifications().removeDeliveredNotification(notificationId);