onNotification does not fire when tapping notification and app is in background with activity "closed"
See original GitHub issueI 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.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8
Top GitHub Comments
Same here. Did you find any workaround to this?
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 :