I only use local notifications and everything works fine (i.e. the onNotification callback fire when tapping a notification) except for when tapping a notification and the app is in the background after using the back button to "close" the app. It works fine when the app is dead, when the app is in the foreground or in the background while an activity is "open".
This is the log from Android Studio after tapping the back button to "close" the app and then the last line that probably hints to the solution appear when tapping the notification:
_Update: The following appear in the log also when AppState change to 'active', i.e. when tapping the launcher icon etc._
W/libEGL: EGLNativeWindowType 0x7a4db0c010 disconnect failed
W/System: A resource failed to call response.body().close().
W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@c41a823
Relevant info from package.json:
"react": "16.9.0",
"react-native": "0.61.5",
"react-native-push-notification": "^3.1.9"
I´ve tried the following suggestions from other posts here without resolving the issue:
Adding android:launchMode="singleTask" to <activity android:name=".MainActivity" ... in AndroidManifest.xml as suggested in #1272
Moving PushNotification.configure outside of React components #652
I'm currently researching this issue by debugging with Android Studio and learning what I need to fix it, but are quite new to Android development and java so any feedback on the possible cause of this is highly appreciated.
_Update: When testing a release build the onNotification callback did not fire even on app load. That is why I went for a different workaround described in a post below. Thought it is a special case workaround that's probaly not for most use cases._
Same here. Did you find any workaround to this?
@ferprez, I did find a workaround that seems to fix the issue for me both on android and iOS. I don't use the onNotification callback at all anymore, but store the information I need with AsyncStorage and retrieve it on app load and on AppState change. It will display the stored data even when the notification is rejected and AppState change to 'active' later though, so not a workaround for most use cases, but for my current app that is what I want, so didn't dive into a possible fix for that. When testing a release build the onNotification callback did not fire even on app load, so I began to research other options.
Here is my current solution:
Just before/after PushNotification.localNotificationSchedule() use @react-native-community/async-storage to store the notification data needed for retrieval later, like a text and the notification time.
Create a function e.g. displayStoredNotification() that displays the notification when the stored time is reached and then removes the stored notification.
Execute displayStoredNotification() in AppState change handler when state is 'active' as this will trigger on both app load and app transitioning from the background.
I think I've described the basic setup, though I also use contexts/redux and have to make sure that the redux store is initialized from stored data before I execute displayStoredNotification() so there is a bit more logic involved.
I also found that I need to add android:launchMode="singleInstance" after <application android:name=".MainApplication" in AndroidManifest.xml else I would often get multiple instances of React when switching between foreground/background and this would create multiple AppState change listeners and strange navigation behaviour.
"react": "16.9.0",
"react-native": "0.61.4",
"react-native-push-notification": "^3.1.9"
"@react-native-community/push-notification-ios": "1.1.1"
onNotification is not work.
Hi,
Can you try the version on master, this might be a bug with the default channel not defined
@Dallas62 If you meant to try master as a fix for the original notification issue I can do that in a few days and give you a feedback.
A released as been made 3.3.0.
Hi, I created a new React Native CLI project with RNPN v3.3.0 and set up AndroidManifest.xml to support localNotificationSchedule() as specified in the installation guide
Then I get this error screen:

Hi!
You need to setup RNFirebase in order to use the Library.
Le jeu. 30 avr. 2020 à 13:44, Bjørnar Hvidsten notifications@github.com a
écrit :
Hi, I created a new React Native CLI project with RNPN v3.3.0 and set up
AndroidManifest.xml to support localNotificationSchedule() as specified in
the installation guideThen I get this error screen:
[image: Screenshot_20200430-132630_push_notif_testing]
https://user-images.githubusercontent.com/22876520/80706331-6f259080-8ae8-11ea-8d11-a5858f5f1ddf.jpg—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/zo0r/react-native-push-notification/issues/1341#issuecomment-621781626,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AA2FHUOQ6LC4JGWIE6JBXRTRPFQBHANCNFSM4LGUREEQ
.
Most helpful comment
Same here. Did you find any workaround to this?