Sending push notification from outside Appery Services
Hello, I am sending a push notification message to my app through another server without using the Appery Push services, am using a php script with google api cloud service, am getting the push notification sound with the default icon, I know how to change the push notification icon but the problem is that am getting empty message !!! i am using the following script:
public function googlePush($DeviceID, $Message)
{
// Set POST variables
$url = 'https://android.googleapis.com/gcm/send';
$DeviceID = array($DeviceID);
$Message = array("MSG" = $Message, "MSGCNT" = $Message, "message" = $Message,"sound"="beep.wav");
$fields = array(
'registration_ids' = $DeviceID,
'data' = $Message,
);
$headers = array(
'Authorization: key=' . 'XXXXXX_MY_API_KEYXXXXXXXXXXXX',
'Content-Type: application/json'
);
// Open connection
$ch = curl_init();
// Set the url, number of POST vars, POST data
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));
// Execute post
$result = curl_exec($ch);
if ($result === FALSE) {
echo 'Curl failed: '.curl_error($ch);
}else{
echo $result;
}
// Close connection
curl_close($ch);
//echo $result;
return;
}
What are the attributes to be used so that the push notification shows the message content.
Thanks in advance