Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onNotification doesn't work second time when clicking on notification from killed mode #1814

Closed
Sheleya opened this issue Jan 11, 2021 · 6 comments

Comments

@Sheleya
Copy link

Sheleya commented Jan 11, 2021

Bug

I have scheduled two local notifications one after another immediately. App is killed. Waiting when notification center will have two notifications. Pressing on first one will open the app and the onNotification method will trigger (OKAY), but staying in the app after opening, clicking on second notification in the foreground will not trigger the onNotification.
.configure set in index.js file.
Android-only bug.

Environment info

react-native: 0.63.3
react-native-push-notification: 6.1.3

Steps To Reproduce

  1. Schedule two notifications one after another
  2. Kill the app
  3. Click on the first notification
  4. Staying in the app click on the second notification

Describe what you expected to happen:
Both onNotification methods should trigger.
But triggers only first.

Reproducible sample code

  PushNotification.configure({
    onRegister: function (token) {},
    onNotification: function (notification) {
      handleNotification(notification);
      notification.finish(PushNotificationIOS.FetchResult.NoData);
    },
    onAction: function (notification) {},
    onRegistrationError: function (err) {
      console.error(err.message, err);
    },
    permissions: {
      alert: true,
      badge: true,
      sound: true,
    },
    popInitialNotification: true,
    requestPermissions: Platform.OS === 'ios',
  });
@Dallas62
Copy link
Collaborator

Hi @Sheleya
It's the same behaviour as iOS, and it's the expected behaviour. The initial notification is the one that start the application, not the second one.
Regards,

@Sheleya
Copy link
Author

Sheleya commented Jan 11, 2021

Hi @Sheleya
It's the same behaviour as iOS, and it's the expected behaviour. The initial notification is the one that start the application, not the second one.
Regards,

No.
Pressing on second one should also be handled by onNotification. The first notification starts the app and has additional logic handled by onNotification, and pressing the second notification should also be handled by onNotification, but it's not.

@Dallas62
Copy link
Collaborator

Unable to reproduce, please check the exemple project or issue history, this is probably documented.

@Sheleya
Copy link
Author

Sheleya commented Jan 11, 2021

Unable to reproduce, please check the exemple project or issue history, this is probably documented.

The starting point should be two local notifications in notification center and closed app.
Pressing on first notification should open the app and onNotification method should be triggered, then you should press on second notification in the foreground and the onNotification method should be triggered second time.

Have you reproduced in this way?

@Dallas62
Copy link
Collaborator

Yes, please take a look to the exemple project.

@sazzadiproliya
Copy link

Please check this answer...
#1501 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants