I recently tackled push notifications for a client project that was
WAY more in-depth than I imagined (and initially quoted for). Using
the LC tutorials for push notifications with APNsAssistant and
AnroidGCM I was able to add push notification sending from a
standalone desktop app created entirely in LC to a mobile app also
created entirely in LC.
The most difficult element was collecting and maintaining all the
unique push IDs from end users of the mobile app that is being
communicated to. I have the mobile app "phone home" with that push id
(pushNotificationReceived) and add an entry in a remote database on a
LC server by way of the super-helpful API provided by HostM. The
desktop app queries the database for unique IDs of users and looks at
the length of the push ID to determine if it is iOS or Google
(couldn't find definitive documentation on the format of these IDs,
but iOS has < and > symbols and is considerably shorter than
Android IDs) then references the appropriate code base to format and
send the message (iOS has a header and payload, Android has a header
and sub-header and playload).
This is a shotgun approach that inevitably attempts to send more
notifications than there are actual users because I have discovered
that these IDs seem to change over time (not sure when or why). I see
this as a no harm/no foul approach because each device can only have 1
unique ID per app, so some of the messages get transmitted but never
received. Android returns an error message in the JSON for each
attempt flagging it as successful or not, iOS does not.
I was able to get Unicode emoji support in the messages, but have a
real half-ass method of entering them right now that I intend to
update at some point. Currently I have a browser widget that loads a
third-party webpage of emojis (emojipedia.org) that needs to be copied
and pasted into a text field... but the website uses a copy button to
truly copy that doesn't work in my standalone so I have instructed my
end-user to select the emoji from that browser widget and
right-click/ctrl-click to copy to the clipboard and paste into the
field.
--Andrew Bell
Mike:
Hmm? I downloaded APNsAssistant, which is linked to the lesson. Is
this the one that you modified and re-posted to gitHub?
A quick perusal of that stack, it looks like he uses a shell command
to simulate the sending of an alert. Is that how a notification is
intended to be sent, or is this method only for testing? If a
notification could be initiated from the app, it would eliminate the
need for a server, except to store the receiver
information/tokens/whatever is needed. That would be preferable. But
??
So, sorry for seeming dense, but I?m confused over the role of the
?server?. Whether a service like onesignal is required to distribute
push notifications, or whether the initiator app can just get the
info from some database and send the notifications from the app
directly without activating some network server api that does the
sending.
Best,
Bill P
_______________________________________________
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