2014-05-07 69 views
0

我是新來的Android GCM服務,我用PHP發送消息我得到 作爲響應的Android GCM訊息發送不接收

{"multicast_id":5035179847798608085,"success":1,"failure":0,"canonical_ids":0,"results":[{"message_id":"0:1399447523487490%5695579af9fd7ecd"}]} 

它看起來像它的劑量送,但在我的Android不接收應用

這裏是我的PHP代碼:

 $registrationId="APA91bHx1bvBURGF4YSMDWGd5fPb33YtWfwEDspbsT-ejAYR0K_rao7NCSUtki7bP_1BvoCWn8fNpqAIPSjchvcy2JGtdJPvVC85cU9fhFoiE-Cos7PyhUhqIkpXznrD2rNhg9sVlWF2J5c9vSLLHP0LJDq5Q5M29dnUGzaROWcGBqsw3673VKM"; 
    // API access key from Google API's Console 

    // Message to send 
    $message  = "the test message"; 
    $tickerText = "ticker text message"; 
    $contentTitle = "content title"; 
    $contentText = "content body"; 

    //$registrationId = 'DEVICE_ID'; 
    $apiKey = "AIzaSyBx6hRnATNJGeYqeF4fzZLrNriuV2TRacI"; 

    $response = sendNotification(
     $apiKey, 
     $registrationId, 
     array('message' => $message, 'tickerText' => $tickerText, 'contentTitle' => $contentTitle, "contentText" => $contentText) 
    ); 


    echo $response; 




     $data = array(
      'data'=>$messageData, 
      'registration_ids' => array($registrationIds) 

     ); 


     var_dump($headers); 
     var_dump ($data); 
     $ch = curl_init(); 
     $data= json_encode($data); 

     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); 
     curl_setopt($ch, CURLOPT_URL, "https://android.googleapis.com/gcm/send"); 
     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); 
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
     curl_setopt($ch, CURLOPT_POSTFIELDS, $data); 

     var_dump ($data); 
     $response = curl_exec($ch); 
     curl_close($ch); 

     return $response; 
    } 

需要幫助

回答