im getting mismatch senderid
error.
in gcm
, i double checked the sender id as client app project id and api_key.
My code is,
$ids = array( 'APA91bFDc......._p' );
$data = array( 'message' => 'Hello World!' );
$apiKey = 'AIzaSyA0_CFcI.........saGySJBE';
$url = 'https://gcm-http.googleapis.com/gcm/send';
$sender_id = '1063000000016';
$post = array(
'registration_ids' => $ids,
'data' => $data,
);
$headers = array(
'Authorization: key=' . $apiKey,
'Sender: id=' .$sender_id,
'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_POSTFIELDS, json_encode( $post ) );
$result = curl_exec( $ch );
if ( curl_errno( $ch ) )
{
echo 'GCM error: ' . curl_error( $ch );
}
curl_close( $ch );
echo $result;
my response is
{"multicast_id":7107329859481637548,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"MismatchSenderId"}]}
why i'm facing the problem?
I refered the previous questions like, GCM Sender Id Mismatch, Android C2DM sender id, Unique SMS sender id? and etc
edit
I just added the sender id myself to the headers. where to mention the sender id and how to mention in php