【发布时间】:2017-03-01 23:57:21
【问题描述】:
我正在使用我的 ios react 本机应用程序测试我的 firebase 消息传递实现,并通过 firebase 仪表板发送通知 - 但它显示已发送 0 条消息。我正在使用这个库及其示例代码:
https://github.com/evollu/react-native-fcm
我已尝试直接放入 firebase 消息令牌以向我的单个测试设备发送消息,但这也发送了 0 条消息。
如何调试 Firebase 中发生的事情?我可以在某处看到已注册设备的列表吗?我已经在 Apple 和 Firebase 上配置了 APN 证书,所以不知道下一步该去哪里。
我在我的应用中获得了一个 firebase 令牌,因此不确定是否还有其他需要做的事情。
class App extends Component {
componentDidMount() {
FCM.requestPermissions(); // for iOS
FCM.getFCMToken().then(token => {
saveTokenToMyProfile(token);
});
this.notificationListener = FCM.on(FCMEvent.Notification, async (notif) => {
// there are two parts of notif. notif.notification contains the notification payload, notif.data contains data payload
if(notif.opened_from_tray){
//app is open/resumed because user clicked banner
}
this.refreshTokenListener = FCM.on(FCMEvent.RefreshToken, (token) => {
console.log(token)
// fcm token may not be available on first load, catch it here
});
}
【问题讨论】:
标签: firebase react-native firebase-cloud-messaging