【发布时间】:2017-06-02 10:50:26
【问题描述】:
我正在收到来自服务器的通知。收到通知后,当我点击它时,同样的通知又来了。更多我点击它更多的通知来了。
我的问题是我在上面的代码中是否遵循了正确的方法?如果没有,请向我推荐正确的。如何处理点击通知?所以,我可以在点击时显示特定的视图。
我正在使用以下链接 https://github.com/zo0r/react-native-push-notification
提前致谢:)
PushNotification.configure({
onNotification: function (notification) {
console.log('NOTIFICATION:', notification)
PushNotification.localNotification({
largeIcon: "ic_launcher",
title: notification.title,
message: notification.message,
});
},
senderID: "my sender ID",
popInitialNotification: true,
requestPermissions: true,
});
【问题讨论】:
-
我认为您应该检查通知是远程通知还是本地通知。通常情况下,如果是远程通知,则发送本地通知,如果是本地通知,则与用户进行交互。
-
在 Navneet 建议的答案的帮助下解决了我的问题
标签: android ios firebase react-native firebase-cloud-messaging