Android push notifications

Pierre Sahores sc at sahores-conseil.com
Sat Mar 30 15:45:22 EDT 2013


This script works ok in about displaying what's needed instead of "Notification received" ($abstract) :

> <?php
> 
> $registrationIDs 	= Array(###devices###);
> $title 				= "###title###";
> $abstract 			= "###abstract###";
> $payload 			= "###payload###";
> $badge 				= "###badge###";
> $apiKey			 	= "###authent###";
> $url 				= "https://android.googleapis.com/gcm/send";
> 
> $fields = array(
> 	'registration_ids' => $registrationIDs,
> 	'collapse_key' => 'abcdef',
> 	'data' => array('title' 	=> $title,
> 					'alert' 	=> $abstract,
> 					'body' 		=> $abstract,
> 					'payload' 	=> $payload,
> 					'badge' 	=> intval($badge),
> 					'sound' 	=> 'default'
> 					)
> );
> 
> $headers = array('Authorization: key=' . $apiKey, 'Content-Type: application/json');
> 
> $ch = curl_init();
> 
> curl_setopt($ch, CURLOPT_URL, $url);
> curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
> curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
> curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
> curl_setopt($ch, CURLOPT_POST, true);
> curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
> 
> $result = curl_exec($ch);
> 
> curl_close($ch);
> 
> echo $result;
> 
> ?>

but, on the other side, i can't get any sound to play when the message arrives on the device. Any toughs welcome :-)

Best,

Le 30 mars 2013 à 19:11, John Craig a écrit :

> I've added iOS and Android push notifications to a stack I've been working on.  When sending notifications to my android device, the message displayed when the notification arrives is 'Notification received'.  Does anyone know how to change (if possible) this message to something more meaningful - I've not found this so far in google's docs.
> 
> TIA
> 
> John.
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

--
Pierre Sahores
mobile : 06 03 95 77 70
www.sahores-conseil.com





More information about the Use-livecode mailing list