如何取消反应式水龙头上的通知。
我在react native及其工作中集成了通知,但是当我点击通知时,我想关闭通知。
我正在收到以下函数的回叫。
firebase.notifications().onNotificationOpened((notificationOpen) => {
const { title, body } = notificationOpen.notification;
console.log("Notification Received - " + body)
}
答案 0 :(得分:0)
添加此行
notification.android.setAutoCancel(true);
this.notificationListener = firebase.notifications().onNotification(notification => {
console.log("OnNotification", notification)
notification.setTitle("MyApp")
notification.android.setPriority(firebase.notifications.Android.Priority.High)
notification.android.setAutoCancel(true) //add this line
notification.android.setChannelId("test-channel")
firebase.notifications().displayNotification(notification);
})