2
votes

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

1

1 Answers

1
votes

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