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 is getting triggered as soon as notification is received in IOS

See original GitHub issue

Bug

onNotification Event handler is getting fired as soon an notification is received on IOS. Also, when user click on the notification, onNotification getting triggered but the data object doesn’t have value.

But in android its working fine, when notification is recived, it doesnt get triggered. When user click on it, then only the onNotification is getting triggered and it also contain all the data.

Environment info

Library version: 8.1.1

Reproducible sample code

  PushNotification.configure({
            onNotification: function (notification) {
                if (!notification?.data) {
                    return;
                }
                console.log('[ON OPEN NOTIFICATION]', notification);
                onOpenNotification(Platform.OS === 'ios' ? notification.data : notification.data.data);
                if (Platform.OS === 'ios') {
                    notification.finish(PushNotificationIOS.FetchResult.NoData);
                }
            },

        });

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11

github_iconTop GitHub Comments

github_iconTop Results From Across the Web

How to trigger "onNotification" function on received notification?
my "onNotification" function is not triggered when getting remote notification. I have used the same flow explained inside example app.
Read more >
How to trigger "onNotification" function on received notification?
Typically occurs when APNS is having issues, or the device is a simulator. (iOS) onRegistrationError(err) { console.log(err); } attachRegister( ...
Read more >
react-native-community/push-notification-ios Code Examples
onNotification (notificationObj) } }) // Get notifications that were triggered when the app was backgrounded PushNotificationIOS.
Read more >
Ionic3.9 onNotification not triggered when app is in foreground ...
... state and but in IOS onNotification doesn't trigger when the app is in ... But I was able to get the notification...
Read more >
SDK Notification Event Handlers - OneSignal Documentation
Force-quit Notification Received Event, iOS - Force-quit state is when the app has been "swiped away" and not running in the foreground or...
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