I can't get the badge count on ios when the app is in the background and closed.I have referred this issue #1824. But it has closed, I didn't get any solution from that.
I am sharing a piece of code what I have used to get notifications
this.notificationListener = firebase .notifications() .onNotification(async (notification) => { const localNotification = new firebase.notifications.Notification({ show_in_foreground: false }) .setNotificationId(notification.notificationId) .setTitle(notification.title) .setBody(notification.body) .setData(notification.data) .android.setChannelId("fcm_default_channel") .android.setSmallIcon("@drawable/wasfat") .android.setAutoCancel(true) .android.setColor("#b61b33") .android.setPriority(firebase.notifications.Android.Priority.High); let badgeCount = await firebase.notifications().getBadge(); firebase.notifications().setBadge(badgeCount + 1); firebase.notifications().displayNotification(localNotification).catch(err => { }); });
from the above code, I'm getting notification very fine in all cases. But I'm able to get badge count, only app is in the foreground.
Please suggest, If anything I have missed to get badge count when the app is in the background and closed.
I am facing this only on ios. For android, it is working fine without the setBadge() method.
Platform: iOS react-native: 0.61.5react-native-firebase: 5.5.6
Thanks for any help.