How to get a count of the push notifications using react-native-firebase

一笑奈何 提交于 2020-07-22 05:32:08

问题


I want to set the count of the badge per hand in react-native with firebase.

firebase.notifications.setBadge(number)

how to get the number?


回答1:


you can use firebase.notifications.getBadge(), like described in the Docs: https://rnfirebase.io/docs/v5.x.x/notifications/reference/Notifications#getBadge

But I wonder, it doesn't seem to be the total of received messages. I think the Idea behind this is, that you add (and increment for each message) an setBadge to your onNotifications.

But the question at all (I think thats also what the Thread-Opener means), how do I get the total number of received messages per app. It should be possible, because it's still used in Android:




回答2:


RN-Firebase >= v6 The above answer was for RN-Firebase v5.x Since v6.x, some notification functionality was removed, to keep only the basic one. In the documentation they point users to a seperated Library named Notifee.

So you'll find the getBadge-Replacement here

⇓⇓⇓⇓⇓⇓⇓⇓⇓

BUT watch out,

notifee isn't free for production: See Pricelist. So if anybody have suggestions for a free implementation of those badges, feel free to post heres!



来源:https://stackoverflow.com/questions/53854719/how-to-get-a-count-of-the-push-notifications-using-react-native-firebase

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!