-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
onNotification does not fire when tapping notification and app is in background with activity "closed" #1341
Comments
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:
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 |
onNotification is not work. |
Hi, |
@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!
You need to setup RNFirebase in order to use the Library.
Le jeu. 30 avr. 2020 à 13:44, Bjørnar Hvidsten <[email protected]> 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 guide
Then 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
<#1341 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA2FHUOQ6LC4JGWIE6JBXRTRPFQBHANCNFSM4LGUREEQ>
.
|
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.
Relevant info from package.json:
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 #1272Moving 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.
The text was updated successfully, but these errors were encountered: