本文介绍了如何使用 react-native-firebase 获取推送通知的计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在带有 firebase 的 react-native 中设置每只手的徽章数量.

firebase.notifications.setBadge(number)

如何获取号码?

解决方案

您可以使用 firebase.notifications.getBadge(),如文档中所述:

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?

解决方案

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:

这篇关于如何使用 react-native-firebase 获取推送通知的计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 15:41