sms,MMS, and Push Notificstions
MikeKerner at roadrunner.com
Tue Aug 15 13:52:51 EDT 2017
You have to have the app phone home with its id. The id is determined by
the device, and is a product of the device and the app running on it that
is to receive notifications. You can phone home via a filesharing service,
an online db, contacting a webserver, etc. For distinguishing between the
platforms, you can embed "the environment" in your phone home message. The
other thing you can do (which I do) is to store the id before sending it.
Then with each launch of the app or after some other event, you check the
old id and the new one, and if it changes, phone home, again, with the old
id (presuming you don't have some other identifier tied to the app on each
device. If you do, you can send that, instead) and the new id. On the
desktop/server/whatever side, you update, accordingly.
Your app can also check to see if it is receiving notifications, or if
notifications are enabled, and act accordingly, including checking to see
if it has received all the notifications, and if it needs to pull any other
data, since there is no guarantee on either platform that a notification
will be delivered.
As of right now, silent notifications are not supported in LC so we have to
make do with what we have.
On Tue, Aug 15, 2017 at 12:53 PM, Andrew Bell via use-livecode <
use-livecode at lists.runrev.com> wrote:
> 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
>> 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.
>> Bill P
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
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."
More information about the Use-livecode