I've been struggling to make this work on one of my projects, I've tried on a clean react native project with no luck. I've been testing on Android. What am I missing? Please help!
Here's the link: https://github.com/platonish/rn-push-notif-demo
react-native: 0.57.5
react-native-push-notification: 3.1.2
here's the android logcat:
11-21 14:56:58.178 16838 16875 I ReactNativeJS: notif
11-21 14:56:58.197 16838 16876 W ResourceType: No package identifier when getting value for resource number 0x00000000
11-21 14:56:58.197 16838 16876 W RNPushNotification: Unable to find com.dieam.reactnativepushnotification.notification_color in manifest. Falling back to default
11-21 14:56:58.207 16838 16876 E RNPushNotification: failed to send push notification
11-21 14:56:58.207 16838 16876 E RNPushNotification: java.lang.IllegalArgumentException
11-21 14:56:58.207 16838 16876 E RNPushNotification: at android.os.Parcel.readException(Parcel.java:2009)
11-21 14:56:58.207 16838 16876 E RNPushNotification: at android.os.Parcel.readException(Parcel.java:1951)
11-21 14:56:58.207 16838 16876 E RNPushNotification: at android.app.INotificationManager$Stub$Proxy.createNotificationChannels(INotificationManager.java:1587)
11-21 14:56:58.207 16838 16876 E RNPushNotification: at android.app.NotificationManager.createNotificationChannels(NotificationManager.java:453)
11-21 14:56:58.207 16838 16876 E RNPushNotification: at android.app.NotificationManager.createNotificationChannel(NotificationManager.java:441)
11-21 14:56:58.207 16838 16876 E RNPushNotification: at com.dieam.reactnativepushnotification.modules.RNPushNotificationHelper.checkOrCreateChannel(RNPushNotificationHelper.java:577)
11-21 14:56:58.207 16838 16876 E RNPushNotification: at com.dieam.reactnativepushnotification.modules.RNPushNotificationHelper.sendToNotificationCentre(RNPushNotificationHelper.java:326)
11-21 14:56:58.207 16838 16876 E RNPushNotification: at com.dieam.reactnativepushnotification.modules.RNPushNotification.presentLocalNotification(RNPushNotification.java:156)
11-21 14:56:58.207 16838 16876 E RNPushNotification: at java.lang.reflect.Method.invoke(Native Method)
11-21 14:56:58.207 16838 16876 E RNPushNotification: at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
11-21 14:56:58.207 16838 16876 E RNPushNotification: at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:160)
11-21 14:56:58.207 16838 16876 E RNPushNotification: at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
11-21 14:56:58.207 16838 16876 E RNPushNotification: at android.os.Handler.handleCallback(Handler.java:790)
11-21 14:56:58.207 16838 16876 E RNPushNotification: at android.os.Handler.dispatchMessage(Handler.java:99)
11-21 14:56:58.207 16838 16876 E RNPushNotification: at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
11-21 14:56:58.207 16838 16876 E RNPushNotification: at android.os.Looper.loop(Looper.java:164)
11-21 14:56:58.207 16838 16876 E RNPushNotification: at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
11-21 14:56:58.207 16838 16876 E RNPushNotification: at java.lang.Thread.run(Thread.java:764)
turns out I was missing this from my AndroidManifest:
<application ....>
<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_name"
android:value="YOUR NOTIFICATION CHANNEL NAME"/>
<meta-data android:name="com.dieam.reactnativepushnotification.notification_channel_description"
android:value="YOUR NOTIFICATION CHANNEL DESCRIPTION"/>
For anyone who's facing issues with an older version of this package, try updating to the latest version, That to work for me.
This shouldn't be closed as RNPN is supposed to fallback to sane defaults when these aren't supplied.
I have a fix in #956
I have the same problem, although I only use localNotifications... This should not be needed (according to the readme...)
Most helpful comment
turns out I was missing this from my AndroidManifest: