Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 28474

react-native push notification onNotification doesn't trigger

$
0
0

I am using zo0r react-native-push-notification library.

"react": "16.0.0-alpha.12",
"react-native": "^0.45.1",
"react-native-push-notification": "^3.0.0"

This code runs every time I open an app:

PushNotification.configure({
    onNotification: function(notification) {
        console.log('onNotification');
        ToastAndroid.show('onNotification', 3000);
    }
});

I send local push notification from background service:

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?

I have opened a GitHub issue as well.


Viewing all articles
Browse latest Browse all 28474

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>