4

I want to redirect to inbox screen after clicking on push notification on android and iOS

Case 1: App already opened on android. - Successfully Working

Push notification received. On Clicking on notification page redirected to inbox successfully.

NOTIFICATION: {"dealer": "SWRoa0ZhSkN4Y2hQNW1NeWtFdHFvSDNlcXIyNnc1TG5PS1hOZjJoMElHST0=", "finish": [Function finish], "foreground": false, "id": "-1073464079", "message": "hello", "messagetype": "RESPONSE", "subject": "ENQUIRY RESPONSE", "title": “Sample 1”, "userInteraction": true}

PushNotification.configure({
  onNotification: function(notification) {
    console.log("NOTIFICATION:", notification);
    console.log('NOTIFICATION CLICK STATE : --->' + notification.userInteraction);
    if(notification.userInteraction === true) {
        NavigationService.navigate('Inbox');
    }
  },
  popInitialNotification: true,
});

Case 2: App running in background or closed on android - Failed

Push notification received. On clicking on notification page redirection not working, only app get opened.

No notification data received

Case 3: On IOS in case of app opened or closed. - Failed

Push notification received. On clicking on notification page redirection not working, only app get opened.

No notification data received

I am using react-native-push-notification library for push notification.

https://github.com/zo0r/react-native-push-notification
Deepali Jadhav
  • 540
  • 2
  • 8
  • 18

1 Answers1

0

Maybe it isn't good to promote other packages. However, I suggest looking into react-native-firebase will be good idea. It provides the feature to handle redirection even when the app is not on foreground.

Rajan
  • 1,512
  • 2
  • 14
  • 18