我正在收到除三星手机以外的所有Android设备的通知。 我将网址从“ https://android.googleapis.com/gcm/send”更新为“ “ https://fcm.googleapis.com/fcm/send”,因为gcm突然停止了向所有设备发送通知。 更新网址后,通知不会发送到三星设备 我没问题,请帮我解决 谢谢 这是我在PHP中的fcm代码
$msg = array(
'message' => json_encode($parsedMsg),
'title' => '',
'subtitle' => '',
'tickerText' => '',
'vibrate' => 1,
'sound' => 1,
'largeIcon' => 'large_icon',
'smallIcon' => 'small_icon'
);
if(count($registrationIds) == 0){
return json_encode(array('success' => 0, 'failure'=>0));
}
$fields = array(
'registration_ids' => $registrationIds,
'data' => $msg
);
$headers = array(
'Authorization: key=' . API_ACCESS_KEY,
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
$result = curl_exec($ch);
curl_close($ch);
return $result;
}