Php GCM响应是Android应用程序的无效注册id

Php GCM响应是Android应用程序的无效注册id,php,android,google-cloud-messaging,Php,Android,Google Cloud Messaging,我正在为android appliction的聊天系统开发一个Web服务,我正在使用GCM(谷歌云消息)。但我总是收到GCM的无效注册响应。我知道这可能是由于我传递给服务器的注册ID的格式造成的,但我确信它与手机在聊天系统中接收到的注册ID相匹配 这是我的代码(我正在发送接收者电话号码gcm注册id): 但我总是得到“不存在”的响应,如果我在这种情况下打印json响应,那么它会显示“无效注册” 请建议我如何解决GCM响应中的此类错误 谢谢您可能是从UrbanAirship复制了apid吗?如果是

我正在为android appliction的聊天系统开发一个Web服务,我正在使用GCM(谷歌云消息)。但我总是收到GCM的无效注册响应。我知道这可能是由于我传递给服务器的注册ID的格式造成的,但我确信它与手机在聊天系统中接收到的注册ID相匹配

这是我的代码(我正在发送接收者电话号码gcm注册id):

但我总是得到“不存在”的响应,如果我在这种情况下打印json响应,那么它会显示“无效注册”

请建议我如何解决GCM响应中的此类错误


谢谢

您可能是从UrbanAirship复制了apid吗?如果是这样,请查看我在

中的答案,您是否知道gcm android中的发件人id和注册id
$registatoin\u id
具有收件人注册id…..检查此项已检查并尝试过…:(你在谷歌控制台上注册了你的应用程序吗
if (isset($_POST["regId"]) && isset($_POST["message"]) && isset($_POST['acceptor_no'])) {
    include_once './config.php';
    //include_once './db_connect.php';
    $con = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
    // selecting database
    mysql_select_db(DB_DATABASE);
    $regId = $_POST["regId"];
    $accepterPhone=$_POST['acceptor_no'];
    $message = $_POST["message"];
    $arr=array();
    $selectDeviceId=mysql_query("select gcm_regid from gcm_users where phone='".$accepterPhone."'");
    $selectDeviceIdRow=mysql_fetch_array($selectDeviceId);
    $accepterDeviceId=$selectDeviceIdRow['gcm_regid'];
    include_once './GCM.php';

    $gcm = new GCM();

    $registatoin_ids = array($accepterDeviceId);
    $message = array("price" => $message);

    $result = $gcm->send_notification($registatoin_ids, $message);
    //$arr['response'] = array('msg'=>$message,'status'=>true,'phone'=>$accepterPhone,'deviceId'=>$regId,'accepterDeviceId'=>$accepterDeviceId);
    //echo json_encode($arr);
  if(isset($result))
  {
    $abc=json_encode($result);
    echo $abc;
    }else
    {
    //echo json_encode($result);
    $msg="Does not Exists";
    $arr['response'] = array('msg'=>$msg,'status'=>false);
            $abc=json_encode($arr);
            echo json_encode($arr);
    }
    }else
    {
    $msg="No data Available";
    $arr['response'] = array('msg' => $msg ,'status'=>false);
    $abc=json_encode($arr);
    echo json_encode($arr);
    }