如果关闭或在后台运行,应如何在React Native Firebase应用中处理推送通知

时间:2018-12-14 14:31:43

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

首先关闭应用程序:

this.notificationOpenedListener = firebase.notifications()
.getInitialNotification()
.then((notificationOpen: NotificationOpen) => {
if (notificationOpen) {
    // App was opened by a notification
    // Get the action triggered by the notification being opened
    const action = notificationOpen.action;
    // Get information about the notification that was opened
    const notification: Notification = notificationOpen.notification;
}
});
如果应用程序在后台运行,则

秒:

this.notificationOpenedListener = firebase.notifications()
    .onNotificationOpened((notificationOpen: NotificationOpen) => {
    // Get the action triggered by the notification being opened
    const action = notificationOpen.action;
    // Get information about the notification that was opened
    const notification: Notification = notificationOpen.notification;
 });

如何首先和第二次连接代码。

引用:a link

还是如何鞭打关闭或在后台运行的应用程序本机?

0 个答案:

没有答案