Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

onNotification called only once in Android and not called again on notification open(userInteraction not updated) #333

Closed
@Mindaugas-Jacionis

Description

@Mindaugas-Jacionis

I have a function that is called on onNotification. This function checks for link that comes in data and checks for user interaction to be true - if condition passes then navigation function is called to navigate to needed screen in the app.

All this looks something like:

PushNotification.configure({
....
      onNotification: this._onNotification.bind(this),
....
});

_onNotification(notification) {
....
    if (notification && notification.userInteraction) {
      let data = notification.data || {};
      if (data && data.link) {
        //do navigation to link
      }
    }
  }

This works all good with iOS where notification.userInteraction changes from false to true on notification click and app opening. The onNotification is called once more and passes condition, therefore does the navigation. With android as far as I got from debugging the app - onNotification is called only once and only on notification being received, when you click on notification to open app - onNotification is not updated and called once more.

My current RN version is 0.39 and current react-native-push-notification version is 2.2.1

Any ideas or suggestions that would help to resolve the issue? :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions