我收到以下错误,我正在尝试将PHP中的Google云消息传递集成到Android,任何解决方案
{"multicast_id":5864514048533725299,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration" }]}
PHP代码
<?php
if (isset($_GET["regId"]) && isset($_GET["receiver_id"]) && isset($_GET["sender_id"])) {
$regId = $_GET["regId"];
$receiver_id = $_GET["receiver_id"];
$sender_id = $_GET["sender_id"];
include_once './db_functions.php';
include_once './GCM.php';
$db = new DB_Functions();
$gcm = new GCM();
//echo $sender_id. $receiver_id; exit;
$res = $db->storeUser($sender_id, $receiver_id);
$registatoin_ids = array($regId);
$message = array("message" => 'You have friend request');
$result = $gcm->send_notification($registatoin_ids, $sender_id, $receiver_id, $message);
echo $result;
}
?>
- 检查您的设备 ID 是否已更新?
- 检查您在 Web API 中输入API_key是否在 console.google.com 上可用?
- 检查API_key是否属于您用于生成设备令牌的项目编号?
注册 ID 无效 检查注册 ID 的格式 您传递给服务器。确保它与注册 ID 匹配 手机在com.google.android.c2dm.intent.REGISTRATION中接收 意图,并且您没有截断它或添加其他 字符。当错误代码为无效注册时发生。源
因此,基本上您在将手机收到的DeviceID发送到服务器时出错。