【发布时间】:2019-07-01 12:55:26
【问题描述】:
我有一个 react-native 应用程序 (android) 来接收来自 firebase 控制台的推送通知。
react-native-firebase 中是否有任何函数可以从推送通知消息中获取键和值(自定义数据)?
【问题讨论】:
标签: firebase react-native push-notification key react-native-firebase
我有一个 react-native 应用程序 (android) 来接收来自 firebase 控制台的推送通知。
react-native-firebase 中是否有任何函数可以从推送通知消息中获取键和值(自定义数据)?
【问题讨论】:
标签: firebase react-native push-notification key react-native-firebase
在您的通知侦听器中尝试从data 对象中提取您的自定义键/值
const { data } = notificationOpen.notification;
alert(data.myKey);
【讨论】:
const notificationOpen: NotificationOpen = await firebase.notifications().getInitialNotification(); const notification: Notification = notificationOpen.notification; var jsondata = notification.data