question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Duplicate onNotification calls

See original GitHub issue

Hey,

I appear to be getting duplicate notifications for both iOS and Android. For a given push (without interaction) I get the onNotification handler called twice. For noisy/mixed notifications this means two notifications are shown in the notification centre.

E.g. from Android This one appears to have the google metadata

{
    color: null
    data: {someData: "example"}
    finish: ƒ finish()
    foreground: true
    google.delivered_priority: "normal"
    google.message_id: "0:1559037885338181%6af40c24f9fd7ecd"
    google.original_priority: "normal"
    google.sent_time: 1559037885334
    google.ttl: 2419200
    id: "1513948521"
    message: "aBody"
    pinpoint.campaign.campaign_activity_id: "ad08775a9d21480aab6768c024060627"
    pinpoint.campaign.campaign_id: "24d11aa26b934153b5bde9205993e33e"
    pinpoint.campaign.treatment_id: "0"
    sound: "default"
    title: "aTitle"
    userInteraction: false
}

This one appears is the same but without google metadata

{
    color: null
    data: {someData: "example"}
    finish: ƒ finish()
    foreground: true
    id: "1505484046"
    message: "aBody"
    pinpoint.campaign.campaign_activity_id: "ad08775a9d21480aab6768c024060627"
    pinpoint.campaign.campaign_id: "24d11aa26b934153b5bde9205993e33e"
    pinpoint.campaign.treatment_id: "0"
    sound: "default"
    title: "aTitle"
    userInteraction: false
}

is anybody else experiencing this?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9

github_iconTop GitHub Comments

33reactions
paul-dohertycommented, May 28, 2019

@SilwalUjjwal Thank you very much. You were bang on the money.

https://developers.google.com/cloud-messaging/android/android-migrate-fcm agrees with you stating

The FCM SDK automatically adds all required permissions as well as the required receiver 
funtionality. Make sure to remove the following obsolete (and potentially harmful, as they 
may cause message duplication) elements from your app's manifest:

I removed

   <!-- < 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() > -->

and no longer receive them twice

Thanks again

0reactions
rakesho-velcommented, Nov 8, 2021

@hukpavlo , no, but I updated my implementation to make sure it doesn’t affect the app functionality when user clicks on notification.

Read more comments on GitHub >

github_iconTop 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 >
Duplicate notifications - react-native-push-notification
So, all I had to do was to call PushNotification.deleteChannel('DUPLICATE_CHANNEL_ID') for the unnecessary channel. I called the dfelete ...
Read more >
Duplicate CIs - ServiceNow Docs
When the instance encounters duplicate CIs during identification and reconciliation, it groups each set of duplicate CIs into a de-duplication task for ......
Read more >
Start an Activity from a Notification - Android Developers
To start an activity that includes a back stack of activities, you need to create an instance of TaskStackBuilder and call ...
Read more >
react-native-push-notification - npm
... remote notifications (for prevent duplicating while showing local ... if true onNotification will be called (Android) onAction: function ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found