With the new update, FCM is now going to be used.
I tried the sample app from git and it\'s working all fine. I can send notifications from the console.
But
function send_fcm($tokens,$message)
{
$url = 'https://fcm.googleapis.com/fcm/send';
$priority="high";
$fields = array(
'registration_ids' =>$tokens,
'data' =>$message
);
$headers = array(
'Authorization:key=your key',
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
echo json_encode($fields);
$result = curl_exec($ch);
curl_error($ch);
if ($result === FALSE)
{
die('Curl failed: ' . curl_error($ch));
}
curl_close($ch);
return $result;
}
store device ids in token variable in an array format