Re: mobile push notifications how-to

2013-02-12 Thread Mike Kerner
Chris,

Back at the beginning of 2012 we were messing around with getting this
done, when John Craig put out a stack to the list called "APNSAssistant".
It works great and has the whole process all laid out.  There is a big long
discussion amongst all of us.  If Pierre's response doesn't get you where
you want to go, email me and we'll work it out.  Easy is an understatement.


On Fri, Feb 1, 2013 at 1:59 PM, Chris Sheffield wrote:

> Does anybody have a how-to guide for using  push notifications? I've read
> through the dictionary and the iOS release notes about how to handle
> received notifications, but how does one actually send out a message? The
> docs mention a "Push Notification Server" and registering for the service,
> but I don't understand how you do that. Is it done through iTunes Connect
> somewhere?
>
> I'm probably just a little thick today, but I can't seem to figure this
> out.
>
> Thanks,
> Chris
>
>
>
> --
> Chris Sheffield
> Read Naturally, Inc.
> www.readnaturally.com
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: mobile push notifications how-to

2013-02-04 Thread Pierre Sahores
In response to your previous question :

1.- The client side HTTP REST POST LC-client-side app button :

> global DevicesList,MIAD
> 
> on mouseUp
>beep
>if pm_length() <= 138 then 
>put "Envoi du message Push à tous les prospects..." into fld "prompt"
>   set httpHeaders to "Content-type: application/x-www-form-urlencoded" & 
> return
>   get url MIAD
>   post URLEncode("authentpostkey=" & hexDigest("authentpostkeyvalue") & 
> "&message=push&devices=" & DevicesList & "&badge=" & trim(fld 
> "message_badge") & \
> "&title=" & trim(utf8encode(bslasher(fld "message_title"))) & 
> "&abstract=" & trim(utf8encode(bslasher(fld "message_abstract" & \
> "&payload=" & trim(utf8encode(bslasher(fld "message_payload"))) 
> to URL MIAD
>   put "Aucun traitement en cours..." into fld "prompt"
>else answer "Erreur : votre message comporte" && pm_length() && "pour une 
> limite APNS (Apple Push Notifications Server) supportée de 138 caractères." 
> && \
>  "Merci de corriger votre message pour éviter qu'il ne soit 
> automatiquement rejeté par le serveur APNS de distribution de votre message 
> vers les devices iOS"
> end mouseUp

where DevicesList contains the iOS and Android IDs of the devices you want to 
push the message too (out of a server-side SQL table you need to setup and 
interact with in HTTP REST POST for best results), MIAD targets the http path 
of the mobile push.lc script (see below) and function pm_length() verifies that 
the push message length don't exceeds the APNS practical allowed limit.

2.- mobile push.lc : the main server-side lc script to install in the cgi-bin 
directory (PostIn contains the client-side HTTP REST POST DATA) :

> split PostIn by "&" and "="
> 
> ### APNS maxi : 100 000 par envoi ### --> Apple Push Notification 
> Server
> put url ("file:" & local path to ipush.php") into tpushvar
> put tpushvar into tpushtmp
> put "0" into tcpteur
> repeat for each line l in PostIn["devices"]
>if length(l) is "64" then
>   put "$devices[" & tcpteur & "] = '" & l & "';" & return 
> after lesdevices
>   add 1 to tcpteur
>end if
> end repeat
> replace "###devices###" with "$devices = Array();" & return & 
> trim(lesdevices) in tpushvar
> replace "###title###" with "$title = '" & PostIn["title"] & "';" 
> in tpushvar
> replace "###abstract###" with "$abstract = '" & 
> PostIn["abstract"] & "';" in tpushvar
> replace "###payload###" with "$payload = '" & PostIn["payload"] & 
> "';" in tpushvar
> replace "###badge###" with "$badge =" && PostIn["badge"] & ";" in 
> tpushvar
> replace "###authent###" with "$ck = 'path to your APNS private 
> key';" in tpushvar
> replace "###passwd###" with "$passphrase = 'your APNS 
> passphrase';" in tpushvar
> put tpushvar into url ("file:" & local path to ipush.php")
> get url ("http path to ipush.php")
> put tpushtmp into url ("file:" & local path to ipush.php")
> put it into apnsreply
> 
> ### GPNS maxi : 1000 par tranche envoyée ### --> Google Push 
> Notification Server
> put "" into lesdevices
> put url ("file:" & local path to apush.php") into tpushvar
> put tpushvar into tpushtmp
> repeat for each line l in PostIn["devices"]
>if length(l) is not "64"
>then put setquote(l) & "," after lesdevices
> end repeat
> put "1" into tranchenumber
> put "1" into tranchestart
> put "" into devicestranche[1]
> if the num of items in lesdevices > 1000 then
>repeat with c = 1 to 1+(the num of items in lesdevices div 
> 1000)
>   put item tranchestart to 999+tranchestart of lesdevices 
> into devicestranche[tranchenumber]
>   add 1 to tranchenumber
>   add 1000 to tranchestart
>end repeat
> end if
> if devicestranche[1] is "" then
>replace "###devices###" with char 1 to -2 of lesdevices in 
> tpushvar
>replace "###title###" with PostIn["title"] in tpushvar
>replace "###abstract###" with PostIn["abstract"] in tpushvar
>replace "###payload###" with PostIn["payload"] in tpushvar
>replace "###badge###" with PostIn["badge"] in tpushvar
>replace "###authent###" with "yourGPNSKey" in tpushvar
>put tpushvar into url ("file:" & local path to apush.php")
>get url ("http path to apush.php")
>put tpushtmp into url ("file:" & local path to apush.php")
>return it & return & apnsreply
> 

Re: mobile push notifications how-to

2013-02-01 Thread Pierre Sahores
Hi Chris,

Will send to this list the LC (push messages editor), PHP (server relayer to 
the APNS and GCM servers) and SQL (devices to send the messages too) scripts i 
use to manage this kind of tasks against iOS and Android next week after coming 
back to desk. Too recent to be really perfect but works indeed ;-)

Best Regards,

Pierre

Le 1 févr. 2013 à 19:59, Chris Sheffield a écrit :

> Does anybody have a how-to guide for using  push notifications? I've read 
> through the dictionary and the iOS release notes about how to handle received 
> notifications, but how does one actually send out a message? The docs mention 
> a "Push Notification Server" and registering for the service, but I don't 
> understand how you do that. Is it done through iTunes Connect somewhere?
> 
> I'm probably just a little thick today, but I can't seem to figure this out.
> 
> Thanks,
> Chris
> 
> 
> 
> --
> Chris Sheffield
> Read Naturally, Inc.
> www.readnaturally.com
> 
> 
> ___
> use-livecode mailing list
> use-livecode@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


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


mobile push notifications how-to

2013-02-01 Thread Chris Sheffield
Does anybody have a how-to guide for using  push notifications? I've read 
through the dictionary and the iOS release notes about how to handle received 
notifications, but how does one actually send out a message? The docs mention a 
"Push Notification Server" and registering for the service, but I don't 
understand how you do that. Is it done through iTunes Connect somewhere?

I'm probably just a little thick today, but I can't seem to figure this out.

Thanks,
Chris



--
Chris Sheffield
Read Naturally, Inc.
www.readnaturally.com


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode