Android 推送通知未发送

Android Push Notification not sending

我正在尝试使用 cakephp 发送推送通知,但未发送推送通知。 现在 GCM id 看起来不同的是 google 更改推送通知过程中的某些内容,例如 (fRAvDRuNUU8:APA91bHvSGxi4AVPx2wGTFWb7OyAPPvXoIAcT)。 每次我得到一个 json 下面给出:

 {
       "multicast_id": 5873180458565135923,
       "success": 0,
       "failure": 1,
       "canonical_ids": 0,
       "results": [
         {
           "error": "NotRegistered"
         }
     ]
 }

我尝试了很多来自互联网的代码,但每次都得到相同的结果。 我正在使用的代码在许多其他应用程序上都能完美运行。 下面是我的代码:

`    public function sendMessageAndroid($registatoin_ids, $message){
     $url = 'https://android.googleapis.com/gcm/send';
     $apiKey = "AIzaSyBf5vaONLbMyGdDoOEeC_MTTh9x1G4Qm-4";
     $fields = array(
        'registration_ids' => $registatoin_ids,//here my gcm id come in //array form array($device_id)
        'data' => $message,//this is my message //$send_message['m']=array('msg'=>$message,'type'=>'chat');
    );  
    $headers = array(
        'Authorization: key=' . $apiKey,
        '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_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
    $result = curl_exec($ch);
    if ($result === FALSE) {
        //die('Curl failed: ' . curl_error($ch));
    }        
   curl_close($ch);
   return $result;
}`

我尝试了所有方法,但没有成功。请帮忙。

是的,我的问题已经解决了now.There我没有错code.it是我的移动开发人员mistake.Whenever你得到的回复如下所示

` { 
       "multicast_id": 5873180458565135923, 
       "success": 0, 
       "failure": 1, 
       "canonical_ids": 0,
       "results": [ { "error": "NotRegistered" } 

` android 代码中的明显错误。