Android push notifications
John Craig
john at splash21.com
Sun Mar 31 09:44:02 EDT 2013
Now that I've tested with the pushNotificationReceived message, this
update delivers the payload data;
# data element of notification
put "New updates available" into tDataA["title"]
put "There are 3 new updates..." into tDataA["body"]
put tDataA["body"] into tDataA["alert"]
put 3 into tDataA["badge"]
put "default" into tDataA["sound"]
put "Payload data" into tDataA["payload"]
# build notification
put tDataA into tNotificationA["data"]
put tTokenA into tNotificationA["registration_ids"]
put "SplashCloud" into tNotificationA["collapse_key"]
jsonEncode tNotificationA, tNotification
# headers
put "Content-Type: application/json" & LF into tHeaders
put "Authorization: key=<Your Key>" & LF after tHeaders
set the HTTPHeaders to tHeaders
# had a couple of errors that were resolved by setting/resetting
this flag :/
#libUrlSetSSLVerification true
# send the notification
post tNotification to url "https://android.googleapis.com/gcm/send"
put it into tResponse
put the result into tResult
More information about the use-livecode
mailing list