3

 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..

Yash Vaghela
  • 562
  • 1
  • 5
  • 16

1 Answers1

1

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

Kishan Bharda
  • 5,446
  • 3
  • 30
  • 57
Johanna Larsson
  • 10,531
  • 6
  • 39
  • 50