-2

I am getting following error I am trying to integrate Google Cloud Messaging in PHP to Android, Any solution

{"multicast_id":5864514048533725299,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration" }]}

PHP CODE

<?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;
}
?>
Mallikarjun S
  • 61
  • 1
  • 4

1 Answers1

1
  1. Check your device id is updated?
  2. check whether API_key you have entered in web api is available at console.google.com?
  3. check whether API_key belongs to the same project number you have used to generate device token?

Invalid Registration ID Check the formatting of the registration ID that you pass to the server. Make sure it matches the registration ID the phone receives in the com.google.android.c2dm.intent.REGISTRATION intent and that you're not truncating it or adding additional characters. Happens when error code is InvalidRegistration. Source

So basically you are making an error in sending the DeviceID received by the phone to the server.

Community
  • 1
  • 1
Ravi
  • 34,851
  • 21
  • 122
  • 183