I am trying the push notification for the first time. I followed a tutorial. After running the code, I send a test push notification from Firebase. The notification is appearing in the console log but its not coming in the notification pane.
My code is as follows:
RemotePushNotification.js
import React, { useEffect } from 'react' import PushNotification from 'react-native-push-notification' const RemotePushController = () => { useEffect(() => { PushNotification.configure({ // (optional) Called when Token is generated (iOS and Android) onRegister: function (token) { console.log('TOKEN:', token) }, // (required) Called when a remote or local notification is opened or received onNotification: function (notification) { console.log('REMOTE NOTIFICATION ==>', notification) }) // process the notification here }, // Android only: GCM or FCM Sender ID senderID: '############', popInitialNotification: true, requestPermissions: true }) }, []) return null } export default RemotePushController AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.app3"> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <permission android:name="${applicationId}.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <uses-permission android:name="${applicationId}.permission.C2D_MESSAGE" /> <!-- < Only if you're using GCM or localNotificationSchedule() > --> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false" android:theme="@style/AppTheme"> <activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" /> <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"/> <!-- Change the resource name to your App's accent color - or any other color you want --> <meta-data android:name="com.dieam.reactnativepushnotification.notification_color" android:resource="@android:color/white"/> <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationActions" /> <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" /> <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> </receiver> <service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService" android:exported="false" > <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT" /> </intent-filter> </service> </application> </manifest> This is the console log
REMOTE NOTIFICATION ==> {"channelId": "fcm_fallback_notification_channel", "color": null, "data": {}, "finish": [Function finish], "foreground": true, "id": "1987265985", "message": "fwafwaawf", "priority": "high", "sound": null, "tag": "campaign_collapse_key_4557183047135736330", "title": "fawfaf", "userInteraction": false, "visibility": "private"}