brozot / Laravel-FCM

Laravel-FCM is an easy to use package working with both Laravel and Lumen for sending push notification with Firebase Cloud Messaging (FCM).
MIT License
888 stars 406 forks source link

contentAvailable is not working anymore #76

Open monsterdream opened 7 years ago

monsterdream commented 7 years ago

I spent some time yesterday trying to solve my problems that my app didn't got badge while sending notification and my app didn't woke up and I found that the 'content-available' => '1' wasn't attached in right place, 'badge' => '1' also. ->setBadge(2) or $dataBuilder->contentAvailable = true didn't worked. I found another package where define pure data was easy like:

            ->data([
                'title' => 'Test FCM',
                'body' => 'This is a test of FCM',
                'content-available' => '1',
                'badge' => '1'
            ])

And that code do the job, my android app catched everything like it should. Are you sure that structure of data sent in notification are still up to date?

This is package which I used: https://github.com/kawankoding/laravel-fcm

brozot commented 7 years ago

Hello, thank you for your interest in this framework,

Can you give me more information about your issue and maybe the piece of code that you are using to construct your notification?

I have tried badges and content-available parameters with an iOS application and it works for me. With OS are you targeting.

Your package sends these parameters

$fields = [
    'registration_ids' => $this->recipient,
    'content-available' => true,
    'priority' => 'high',
    'data' => $this->data,
    'notification' => $this->notification
];

Priority is by default high, have you tried to set priory high in Laravel-FCM also ? Laravel-FCM uses by default a "normal” priority.

you can set it with the following code: $optionsBuilder->setPriority(OptionsPriorities::high);

Best regards,

Nicolas