My question is.. ¿How can I change my GCM priority like google said? I was reading Google Developers when I saw that;
Setting the priority of a message
You have two options for assigning delivery priority to downstream messages: normal and high priority. Delivery of high and normal priority messages works like this:
High priority: GCM attempts to deliver high priority messages immediately, allowing the GCM service to wake a sleeping device when possible and open a network connection to your app server. Apps with instant messaging, chat, or voice call alerts, for example, generally need to open a network connection and make sure GCM delivers the message to the device without delay. Set high priority only if the message is time-critical and requires the user’s immediate interaction, and beware that setting your messages to high priority contributes more to battery drain compared to normal priority messages.
Normal priority: This is the default priority for message delivery. Normal priority messages won't open network connections on a sleeping device, and their delivery may be delayed to conserve battery. For less time-sensitive messages, such as notifications of new email or other data to sync, choose normal delivery priority.
In my PHP when i want to send a notificacion I call this function:
function send_notification($con,$registatoin_ids,$idDestino,$titulo, $message, $nombreOrigenNotificacion, $dia, $mes, $anio, $idCancha, $idOrigen, $esComplejo) {
$url = 'https://android.googleapis.com/gcm/send';
$fields = array(
'data' =>array("idDestino" => $idDestino,"title" => $titulo,"message" => $message,"nombreOrigenNotificacion" => $nombreOrigenNotificacion,"dia" => $dia,"mes" => $mes,"anio" => $anio,"idCancha" => $idCancha,"idOrigen" => $idOrigen,"esComplejo" => $esComplejo),
'registration_ids' => $registatoin_ids
);
$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);
//echo $result;
}
// EDIT: The GCM notification is between Android Phones
So..How can I change the priority GCM message? Thanks
'priority' => 'high'in the payload yet? - AL.datavariable. - AL.