react-native-push-notification
react-native-push-notification copied to clipboard
Notification is appearing in foreground only on Android
I have an issue with notifications sent through FCM are appearing only when the app is in the foreground.
I'm using RN 0.61.4 among with firebase:
"@react-native-firebase/app": "^6.2.0",
"@react-native-firebase/messaging": "^6.2.0",
"react-native-push-notification": "^3.1.9",
Would be grateful for any hint 🙏
I rely on auto-linking so I didn't run link. Here is AndroidManifest.xml
<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" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
...
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="${applicationId}" />
</intent-filter>
</receiver>
<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.RNPushNotificationRegistrationService"/>
<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>
I had the same problem, fixed it by removing this receiver <receiver android:name="com.google.android.gms.gcm.GcmReceiver"
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.