Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FCM not working #195

Open
mubassirhayat opened this issue May 4, 2018 · 1 comment
Open

FCM not working #195

mubassirhayat opened this issue May 4, 2018 · 1 comment

Comments

@mubassirhayat
Copy link

mubassirhayat commented May 4, 2018

Below is my code for FCM
I tested it on an app a while and it worked like a charm but now for some reason, it's not working, can anyone of you help?

$androidDevices[] = PushNotification::Device($user->device_token);
$androidDevicesNotify = PushNotification::DeviceCollection($androidDevices);
$data = [
    'title' => "AppName",
    'body'  => 'You have a new request from User',
    'custom'  => [
        'request_id' => 1
    ]
];
$message = PushNotification::Message('You have a new request from User', $data);
$androidCollection = PushNotification::app('AppAndroid');
$androidCollection->adapter->setAdapterParameters(['sslverifypeer' => false]);
$androidCollection->to($androidDevicesNotify)->send($message);
@Wolg
Copy link

Wolg commented Dec 12, 2018

@mubassirhayat I know this is late, but if someone gets to the same problem – I got it working by updating zendframework/zendservice-google-gcm dependency:
composer update davibennun/laravel-push-notification --with-dependencies
Also make sure you message data contains notificationData key, so your message data could look as follows:

$data = [
    'title' => "AppName",
    'body'  => 'You have a new request from User',
    'notificationData'  => [
        'title' => 'AppName',
        'body' => 'You have a new request from User'
    ]
];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants