Pushnotification Server Side Implementation
Recently i have integreted the FCM in my app recent version but my previous version of app was using GCM. Any ideas about whether we need to segregate the write the background cron
Solution 1:
FCM is still compatible with GCM, seeing as it is it's core. So switching to the FCM endpoint (https://fcm.googleapis.com/fcm/send) when sending your notification should still work for your app versions that have GCM. No need to write separate programs.
Solution 2:
I have working code in my project, you can try it using Firebase of google: Firebase Tutorial
$notification_send ="Message to be sent";
$server_key = '****************************';//Authorization Key$client = new Client();
$client->setApiKey($server_key);
$client->injectGuzzleHttpClient(new \GuzzleHttp\Client());
$message = new Message();
$message->setPriority('high');
$message->addRecipient(new Topic('test'));
$message
->setNotification(new Notification('Reislivsmessen', $notification_send ))
->setData(['key' => 'value']);
$response = $client->send($message);
You have to create topic, here it's "test".
I hope it works for you too.
Post a Comment for "Pushnotification Server Side Implementation"