onNotification is not called when local notification arrives and app is in background in android
Code for Local Noification
PushNotification.localNotification({ autoCancel: true, title: 'Test Title', message: 'Test Message', vibrate: true, vibration: 1000, playSound: false, data: {}, });
Trying to get in configure onNotification
PushNotification.configure({ onRegister: function(token) { console.log('TOKEN:', token); }, onNotification: function(notification) { console.log('NOTIFICATION:', notification); }, permissions: { alert: true, badge: true, sound: true, }, popInitialNotification: true, requestPermissions: true, });
Hi,
onNotification will not be called for local/scheduled notifications if there is no user interaction.
@Dallas62 , It still not working when the app is in background
Does the user interact with the notification ?
Yes set the userInteraction parameter as true
So the user Press the notification and onNotification is not called ?
Does .configure inside a component ?
Do you have a splashscreen in your application ?
Yes onNotification in not called when user press in notifcation when app is in background. .configure is not inside a component. Not having splashscreen
Did you test the example project ?
I compared AndroidManifest.xml from example folder and added all changes
Did you looked at: https://github.com/zo0r/react-native-push-notification/issues/1592
Yes @Dallas62 but not succeed
Can't do more without a reproducible example.
@Dallas62 , I also used PushNotification.popInitialNotification to fulfill my requirement but it also returns undefined randomly
The initial notification is the notification which start the application, bring back to foreground an application in background doesn't change or set the initial notification.
onNotification function gets called in android , but. in ios I am having issue to get response in onNotification function . Do. you have any suggestion on that @Dallas62
Yes this is an issue from the iOS library, looking into it. https://github.com/react-native-community/push-notification-ios/pull/122
Yes this is an issue from the iOS library, looking into it. react-native-community/push-notification-ios#122
do we have any idea on how we can tackle it ?
Hi!
You can test the version on dev branch, react-native-community/push-notification-ios#122 has been merged recently.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.