Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android onNotification never called in react-native-push-notification

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

notification received form the server when i clicked on it app is opened but onNotification never called. i put this in componentDidMount() and constructor in App.js but it's never called.. help..

like image 236
Yash Vaghela Avatar asked Jun 03 '26 03:06

Yash Vaghela


1 Answers

Did you add the required code into the AndroidManifest.xml?

For example :

<!--more stuff above-->
<service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
  android:exported="false" >
  <intent-filter>
    <action android:name="com.google.android.c2dm.intent.RECEIVE" />
  </intent-filter>
</service>

Source: https://github.com/zo0r/react-native-push-notification

like image 92
Johanna Larsson Avatar answered Jun 05 '26 01:06

Johanna Larsson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!