laravel-notification-channels / fcm

Firebase Cloud Messaging (FCM) notifications channel for Laravel
https://laravel-notification-channels.com/
MIT License
476 stars 123 forks source link

Receive Notifications Twice #120

Closed lianmaymesi closed 2 years ago

lianmaymesi commented 2 years ago

Did anyone face the issue of receiving all notifications twice? One Empty notification another one with the real content.

spaky08 commented 2 years ago

I have this same problem ...

lianmaymesi commented 2 years ago
return FcmMessage::create()
            ->setData([
                'title' => 'This is title',
                'body' => 'This is Data body'
            ])
            ->setAndroid(AndroidConfig::create())
            ->setApns(ApnsConfig::create());

I finally found the solutions to this issue. If you use setNotification() the setData() assumes blank data by default. So, we have to remove all setNotification() from Android or APNS, or WebPush.