Пытаюсь отправить уведомление на Android, но получаю ошибку:
{"multicast_id":88286863010470080,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}]}
В чем ошибка?
<?
$fcm_token = htmlspecialchars($_GET['fcm_token']);
echo sendGCM('Test Message', $fcm_token);
function sendGCM($message, $id) {
$url = 'https://fcm.googleapis.com/fcm/send';
$fields = array('registration_ids' => array($id), 'data' => array("message" => $message));
$fields = json_encode($fields);
$headers = array('Authorization: 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_POSTFIELDS, $fields);
$result = curl_exec($ch);
echo $result;
curl_close($ch);
}