Getting Duplicate Notifications (tested on Android)
See original GitHub issueHi,
I’m getting duplicate notifications on Android (haven’t tested ios). My code is quite simple since I’m just starting out:
export default class NotificationService {
static initHandler() {
FCM.on(FCMEvent.Notification, async (notification) => this._handleNotification(notification));
}
static _handleNotification(notification) {
console.log("Got " + notification.messageId);
}
}
and in App.js
NotificationService.initHandler();
export const App = StackNavigator({
Login: {screen: Login}
});
When I push a message from the backend service I get the same alert on the phone multiple times. I also keep getting previous alerts. The backend is not the problem. I checked that the backend is sending each notification once and I have the same app implemented 100% in Kotlin which works perfectly.
I’m fairly certain that I’m not registering multiple handlers since I checked that initHandler() is only called once. I’m very new to RN, am I doing something wrong or is there a known issue?
- versions: “react-native-fcm”: “^11.0.2” and “react-native”: “0.51.0”,
- Device: Samsung S8, Android 7.0
- This happens no matter what the app state is, foreground, background or stopped (cleared from task list).
Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:23 (7 by maintainers)
Top Results From Across the Web
Duplicated Notifications - OneSignal Documentation
Usually duplicate notifications occur due to sending the same push data multiple times. If you see multiple notifications sent in your Delivery Tab...
Read more >Getting duplicate push notifications : r/Android - Reddit
Push notifications come in through Google C2DM mechanism. When I was developing my messaging app I was getting duplicate intents.
Read more >Android received duplicate push notifications (onesignal)
1 Answer 1 ... Usually duplicate notifications occur due to sending the same push data multiple times. If you see multiple notifications sent...
Read more >Stop duplicate chat notifications - Android - Google Chat Help
On your mobile device, open Settings. Tap Apps and notifications and then Chat and then App notifications. Make sure that app notifications are...
Read more >Duplicated notifications in Android - Salesforce Stack Exchange
when I send a push in firebase console theres a problem of duplicated notifications, because etpushsdk uses gcm and my application fcm. I'm ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had to remove
<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>
from AndroidManifest.xml
I was getting duplicated notifications because of developing 2 apps with the same package name.
Both the applications were receiving the Notification