react-native-push-notification: Duplicate notifications are triggering when app is in background with FCM
I am getting duplicate notification (FCM) when app is in background , and only getting single notification when app is in foreground or close, but the problem lies with background state
<manifest` xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.bizfeed">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <!-- <- Add this line -->
<uses-permission android:name="android.permission.VIBRATE" />
<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="com.bizfeed.MainApplication"
android:label="@string/app_name"
android:icon="@drawable/logos"
android:roundIcon="@drawable/logos"
android:allowBackup="false"
android:usesCleartextTraffic="true"
tools:ignore="GoogleAppIndexingWarning"
android:theme="@style/AppTheme">
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
<activity
android:name="com.bizfeed.MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:exported="true"
android:launchMode="singleInstance"
android:label="@string/app_name"
android:windowSoftInputMode="adjustUnspecified">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="bizzfeed.page.link"
android:scheme="https" />
</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" /> <!-- < Only if you're using GCM or localNotificationSchedule() > -->
<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> <!-- < Only if you're using GCM or localNotificationSchedule() > -->
<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>
<!-- Background(Closed) <service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationRegistrationService" /> <!– < Only if you're using GCM or localNotificationSchedule() > –>-->
<!-- CLOSED-->
<service
android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerServiceGcm"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<!-- CLOSED END-->
<!-- </ Only if you're using GCM or localNotificationSchedule() > -->
<!-- < Else > -->
<service
android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<!-- Foreground-->
<!-- <service android:name="io.invertase.firebase.messaging.ReactNativeFirebaseMessagingService">-->
<!-- <intent-filter>-->
<!-- <action android:name="com.google.firebase.MESSAGING_EVENT" />-->
<!-- </intent-filter>-->
<!-- </service>-->
</application>
</manifest>
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 17
This issue should not occured with the latest version, you will need to check the installation process in the README. Many settings in AndroidManifest are not required anymore.
it looks like removing this fix the duplicate notification: