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

Get onNotification triggered when a remote notification is received #2402

Open
rossicler-hostalky opened this issue Jan 9, 2024 · 1 comment

Comments

@rossicler-hostalky
Copy link

rossicler-hostalky commented Jan 9, 2024

Question

Is it possible to make onNotification listener to run every time my app receives a remote notification?

Currently this behaviour is the behaviour for each app state:

Foreground

  • iOS: onNotification is called (this is working after changing AppDelegate.mm)
  • Android: onNotification is triggered

Background

  • iOS: onNotification is not called
  • Android: N/A

Killed/Closed

  • iOS: onNotification is not called
  • Android: N/A

So, I wanted that onNotification would be called for every remote notification received, doesn't matter the app state. After reading some issues in the repository and some posts on stack overflow, it seems to be possible, but I'm not sure.
If anyone have some idea how to achieve this, please let me know.

My goal is to receive remote notifications, but never show remote notifications to the user, and once onNotification is called, send a localNotification instead.

@ericowhadi
Copy link

the reason you are not receiving notification in background or killed is because you are doing the pushNotification.configure after the AppRegistry.registerComponent(appName,()=>App) (ie in App.js). If you do it in index.js, you should receive the notification in all states. It works for me...

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

2 participants