如何使用 react-native-firebase 获取推送通知的数量
How to get a count of the push notifications using react-native-firebase
我想用 firebase 在 react-native 中设置每手徽章的数量。
firebase.notifications.setBadge(number)
如何获取号码?
您可以使用 firebase.notifications.getBadge()
,如文档中所述:https://rnfirebase.io/docs/v5.x.x/notifications/reference/Notifications#getBadge
但是我想知道,这似乎不是收到消息的总数。我认为这背后的想法是,您向 onNotifications
.
添加(并为每条消息递增)一个 setBadge
但根本问题是(我认为这也是 Thread-Opener 的意思),我如何获得每个应用程序收到的消息总数。它应该是可能的,因为它仍然在 Android 中使用:
RN-Firebase >= v6
上面的答案是针对 RN-Firebase v5.x 自从 v6.x,一些通知功能被删除,只保留基本的。在文档中,他们将用户指向一个名为 Notifee.
的单独库
所以你会发现 getBadge-Replacement here
⇓⇓⇓⇓⇓⇓⇓⇓⇓
但请注意,
通知不是免费用于生产:See Pricelist。因此,如果有人对免费实施这些徽章有任何建议,请随时 post 这里!
我想用 firebase 在 react-native 中设置每手徽章的数量。
firebase.notifications.setBadge(number)
如何获取号码?
您可以使用 firebase.notifications.getBadge()
,如文档中所述:https://rnfirebase.io/docs/v5.x.x/notifications/reference/Notifications#getBadge
但是我想知道,这似乎不是收到消息的总数。我认为这背后的想法是,您向 onNotifications
.
setBadge
但根本问题是(我认为这也是 Thread-Opener 的意思),我如何获得每个应用程序收到的消息总数。它应该是可能的,因为它仍然在 Android 中使用:
RN-Firebase >= v6 上面的答案是针对 RN-Firebase v5.x 自从 v6.x,一些通知功能被删除,只保留基本的。在文档中,他们将用户指向一个名为 Notifee.
的单独库所以你会发现 getBadge-Replacement here
⇓⇓⇓⇓⇓⇓⇓⇓⇓
但请注意,
通知不是免费用于生产:See Pricelist。因此,如果有人对免费实施这些徽章有任何建议,请随时 post 这里!