Clicking on local notification - onNotification doesn't get called when app is not started (Android)
See original GitHub issue"react": "16.0.0-alpha.12",
"react-native": "^0.45.1",
"react-native-push-notification": "^3.0.0"
On application start I have this code:
PushNotification.configure({
onNotification: function(notification) {
console.log('onNotification');
ToastAndroid.show('onNotification', 3000);
}
});
My background service sends local push notification:
PushNotification.localNotification({
message: 'Hello World',
smallIcon: 'ic_launcher'
});
The notification gets delivered. When I click it, onNotification
method doesn’t get called, then when I receive another notification, it actually gets called. It seems like it works only if app is in memory atm.
Am I doing something wrong?
stackoverflow question here.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
Clicking on notification doesn't open Android app
The code which I am using for opening app on the click of notification, which is working perfectly fine :
Read more >Notifications Not Shown - Mobile Push
Android Settings App > Notifications > Your App you should see "Show notifications" enable and all categories underneath enabled. If you have a...
Read more >Create a Notification - Android Developers
To get started, you need to set the notification's content and channel ... in the background so the action does not interrupt the...
Read more >Receive messages in an Android app - Firebase - Google
Any notification message that does not explicitly set the icon in the notification payload. Android uses the custom default color for. All notification...
Read more >How to Set up Push Notifications in React Native - Around25
When you get on the firebase site, click on the Android icon to create the ... Since the app will not show notification...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For people who still haven’t figured this out, here is what solved it in my case:
In my reducers.js file
In my pushController.js file
@nonsense66 Hi! I can’t get it to work… This is how I have it.
App.js
PushConfig.js
Nothing is different, the
onNotification
is nevered triggered without pressing/clicking the notification.