【问题标题】:React native Firebase push notification Android反应原生 Firebase 推送通知 Android
【发布时间】:2017-12-18 05:07:32
【问题描述】:

我想在我的 react-native 项目中使用react-native-fcm,当我想在参数中使用令牌向我当前的设备(用于测试)发送推送通知时遇到问题。

我已经从 react-native-fcm 测试了示例应用程序,本地通知工作正常,我尝试使用令牌发送,但我不知道为什么,我的设备上什么也没收到。

这是我的代码

render() {
         FCM.getFCMToken().then(token => { // token android
            firebaseClient.sendNotificationWithData(token)
        });
        //this.showLocalNotification()
        return (
            <Provider store={store}>
                <AppNavigator />
            </Provider>
        );
}

我已经导入了 FirebaseClient 和 PushController

在控制台我有一个成功响应,但我没有收到通知。

【问题讨论】:

    标签: android firebase react-native firebase-cloud-messaging


    【解决方案1】:

    你检查权限了吗? FCM.requestPermissions(); 另外我对此有疑问,我必须将"content_available": true, 添加到有效负载中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-05-29
      • 2021-11-07
      • 2018-04-09
      • 2018-01-17
      • 1970-01-01
      • 2020-09-24
      • 2020-05-07
      • 1970-01-01
      相关资源
      最近更新 更多