question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onNotification does not fire when tapping notification and app is in background with activity "closed"

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8

github_iconTop GitHub Comments

11reactions
ferprezcommented, Mar 16, 2020

Same here. Did you find any workaround to this?

1reaction
Dallas62commented, Apr 30, 2020

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 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 https://github.com/zo0r/react-native-push-notification/issues/1341#issuecomment-621781626, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2FHUOQ6LC4JGWIE6JBXRTRPFQBHANCNFSM4LGUREEQ .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tap on notification does not fire intent with deeplink when app ...
The notifications arrives as expected when the app is in foreground, background and closed (wiped away). Tapping a notification opens the ...
Read more >
Sometime tapping on notification's… | Apple Developer Forums
I am issuing a problem, which seams to be happen randomly. Usually tapping on notification action button on my notification's dynamic interface on...
Read more >
Start an Activity from a Notification - Android Developers
Tapping Back should take the user back through the app's normal work flow to the Home ... So this activity does not need...
Read more >
Receive messages in an Apple app - Firebase - Google
If you are receiving a notification message while your app is in the background, // this callback will not be fired till the...
Read more >
awesome_notifications | Flutter Package - Pub.dev
KeepOnTop: Fires the respective action without close the notification status bar and don't bring the app to foreground. DisabledAction: When pressed, the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found