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

[Question] Click event listener not triggered on push notification when app is force closed #1549

Closed
1 task done
dipendra-sharma opened this issue Sep 5, 2023 · 3 comments

Comments

@dipendra-sharma
Copy link

dipendra-sharma commented Sep 5, 2023

How can we help?

I am currently using "react-native-onesignal": "^5.0.0" for handling push notifications in my app. Everything works as expected when the app is in the background or foreground: the notifications are received and when clicked, the event listener triggers and navigates the user to the appropriate screen.

However, an issue arises when the app is in a force-closed or killed state. Even though the device receives the push notification and the app is launched upon clicking the notification, the click event listener does not get triggered. This results in the user not being navigated to the intended screen.

Platform:

  • Android
  • iOS

Steps to reproduce:

  1. Force close the app.
  2. Send a push notification to the device.
  3. Click on the received notification.

Expected behavior:
Upon clicking the notification, the app should launch and navigate the user to the appropriate screen as per the event listener.

Actual behavior:
The app launches, but the user is not navigated to the intended screen because the click event listener isn't triggered.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@dipendra-sharma dipendra-sharma changed the title Click event listener not triggered on push notification when app is force closed [Question] Click event listener not triggered on push notification when app is force closed Sep 5, 2023
@jennantilla
Copy link
Contributor

@dipendra-sharma thanks for reporting! We'll investigate this and get back to you as soon as possible.

@Bjarkinn
Copy link

This is the same issue as this one

We are experiencing the same problem (only iOS) on version 5.0.0 and this is kind of a dealbreaker for us as navigating to a specific screen upon clicking a notification is a crucial UX in our product.

Has this been investigated and can we expect this to be fixed soon?

We previously used @react-native-firebase/[email protected] to handle push notifications and they had the following method that would also be sufficient @jennantilla

    /**
     * When a notification from FCM has triggered the application to open from a quit state,
     * this method will return a `RemoteMessage` containing the notification data, or `null` if
     * the app was opened via another method.
     *
     * See `onNotificationOpenedApp` to subscribe to when the notification is opened when the app
     * is in a background state.
     */
    getInitialNotification(): Promise<RemoteMessage | null>;

@jennantilla
Copy link
Contributor

@dipendra-sharma @Bjarkinn thank you for your patience!

We have a fix for this in our latest release, 5.0.1. Please let us know if you have any additional questions or concerns!

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