【问题标题】:Get key and value from firebase push notification从 Firebase 推送通知中获取键和值
【发布时间】:2019-07-01 12:55:26
【问题描述】:

我有一个 react-native 应用程序 (android) 来接收来自 firebase 控制台的推送通知。

react-native-firebase 中是否有任何函数可以从推送通知消息中获取键和值(自定义数据)?

【问题讨论】:

    标签: firebase react-native push-notification key react-native-firebase


    【解决方案1】:

    在您的通知侦听器中尝试从data 对象中提取您的自定义键/值

    const { data } = notificationOpen.notification;
    alert(data.myKey);
    

    【讨论】:

    • 是的,我通过使用 firebase.notifications 得到它,谢谢const notificationOpen: NotificationOpen = await firebase.notifications().getInitialNotification(); const notification: Notification = notificationOpen.notification; var jsondata = notification.data
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-11
    相关资源
    最近更新 更多