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 called only when notification toast is tapped

See original GitHub issue

Before posting details about the configured plugin I would ask you if you may know what are the possible causes for this issue: onNotification eventi is fired only when notification toast is tapped. The desired behavior is to get onNotification fired when the remote notification arrives even if the user doesn’t tap it.

configurePushNotifications() is called outside of a RN component.

RN version: 0.63.2 RN Push Notification version: 4.0.0

function configurePushNotifications() {

  PushNotification.configure({

    onRegister: async token => {
      store.dispatch(updateNotificationsInstallationToken(token.token));
    },


    onNotification: notification => {
      console.log('🎈 push arrived! (' + Platform.OS + ')') // We get this balloon only if the user taps the notification...
      console.log('push details: ' + JSON.stringify(notification))

      ...

      notification.finish(PushNotificationIOS.FetchResult.NoData);
    },
    senderID: gcmSenderId
  });
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
mstaicucommented, Jan 9, 2021

I’m also interested in having the onNotification callback called whenever a scheduled local notification is received, instead of the onNotification being called when I tap on the notification. From what I’m reading on the link that you shared it seems that I might be wanting to look into “silent remote push notifications”, correct? If yes, then, can I achieve this without using a server? Before going off to Google, it might be worth asking if you have an example of how one might achieve this or how one has achieved this.

Also, thanks for all the hard work on the library!

0reactions
Dallas62commented, Feb 10, 2021

Hi @mstaicu As said previously, scheduled notifications cannot trigger onNotification before being tapped. And remote notification needs to be send from an external services (your server or some SaaS plateform). Regards,

Read more comments on GitHub >

github_iconTop Results From Across the Web

Notification listener - Windows apps - Microsoft Learn
Learn how to use Notification Listener to access all of the user's ... the only type of notifications supported are toast notifications).
Read more >
Windows Phone navigate to a certain page in app when Toast ...
Try looking at the bottom of MSDN's Toast Properties page. Looks like tapping on a notification defaults to launching your app.
Read more >
react-native-push-notification Code Examples - Snyk
log( 'TOKEN:', token ) }, // (required) Called when a remote or local notification is opened or received onNotification: (notification) => { console.log(...
Read more >
cordova-push-notifications - npm
This plugin allows your application to receive push notifications on Android, iOS, WP8 and Windows8 devices. Android uses Google Cloud Messaging.
Read more >
Get Notifications From Apps And Other Senders Missing
Type notification on the search bar and click on notification & action settings. ... Tap Settings Bluetooth next to the name of your...
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