0
react-native-fcmのトレイから通知をクリックした後、特定のページにリダイレクトしようとしています。任意の助けをいただければ幸いですreact-native-fcmトレイから通知をクリックした後に特定のページにリダイレクトする方法
I follow this tutorial for react-native-fcm
this.notificationListener = FCM.on(FCMEvent.Notification, notif => {
console.log("Notification recived", notif);
if(notif.local_notification){
console.log("Notification recived local", "local notification");
return;
}
if(notif.opened_from_tray){
console.log("Notification recived tray ", "opened from tray");
return;
}
if(Platform.OS ==='ios'){
//optional
//iOS requires developers to call completionHandler to end notification process. If you do not call it your background remote notifications could be throttled, to read more about it see the above documentation link.
//This library handles it for you automatically with default behavior (for remote notification, finish with NoData; for WillPresent, finish depend on "show_in_foreground"). However if you want to return different result, follow the following code to override
//notif._notificationType is available for iOS platfrom
switch(notif._notificationType){
case NotificationType.Remote:
notif.finish(RemoteNotificationResult.NewData) //other types available: RemoteNotificationResult.NewData, RemoteNotificationResult.ResultFailed
break;
case NotificationType.NotificationResponse:
notif.finish();
break;
case NotificationType.WillPresent:
notif.finish(WillPresentNotificationResult.All) //other types available: WillPresentNotificationResult.None
break;
}
}
取り扱いクリックリスナー上の適切な書類を持っていないネイティブのFCMのマニュアルを反応させます。事前
私はあなたが通知を '場合(notif.opened_from_tray){}'ステートメント内でクリックされたときに、やりたいものは何でも追加することができると思います。 –