Push Notifications Examples

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Push Notifications Examples

Post by FireWorx » Wed Jul 16, 2014 2:52 am

Hi,
I just spent the day going through the LC Push notificaction lesson. I was able to make a connection to the apple server and generate a profile that included push notifications. Build a stack with push notifications as a standalone setting and get a push notification message back when the stack opened. Does anyone have a working example that they might like to share? Is anyone using on-rev to store devise ID's and send out push notifications?

I have an update button on my IOS app that will check for the existence of added files and download the those files if needed but it's the users choice. If I actually want to push out notifications that there are updates available I guess I need to further explore push notifications.

Any advise is appreciated.
Dave

splash21
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 369
Joined: Sun Dec 19, 2010 1:10 am
Location: UK
Contact:

Re: Push Notifications Examples

Post by splash21 » Wed Jul 16, 2014 7:44 am

Here's a post from the use list from August, 2012 - should still work fine today 8)
The server now parses .lc scripts, so I've changed the file extensions to .lcx so you can view them through a browser.

----- August 2012 -----
The following info will hopefully help, or at least give you
some ideas. I wrote a 'draw something' style app at the beginning of
the year and although it's never been released, it's delivered thousands
of push notifications on the test service. The scripts run on an on-rev
server. The links below are on another server that doesn't parse .lc
scripts, so they should show up fine in your browser.

Script that runs on LiveCode server and is successfully delivering push
notifications in a test app;
http://splash21.com/info/notify.lcx

I'm also using Mark Smith's libJson 1.0.1b (you'll see it referenced in
the above);
http://splash21.com/info/json.lcx

I've used this script since LC server's been around for MySQL - basic,
but it does what I need it to do ;)
http://splash21.com/info/mysql.lcx

Here's the MySQL structure of the table I use to record device info;
http://splash21.com/info/devices.sql
LiveCode Development & Training : http://splash21.com

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: Push Notifications Examples

Post by FireWorx » Wed Jul 16, 2014 6:24 pm

Ok,
So basically the idea is to capture the devise ID the first time the app opens on the users devise and store it in the MySql database on the on-rev server in the table "devises' along with a few other columns. Then when you want to send out push notifications use the other scripts to send out those notifications. I did familiarize myself with iRev and I am able to alter the MySql database that way from a mobile devise so I think I'm good there however the code examples re: json look a little daunting to me.

Thanks for helping. I may just run a script in my app that executes in the background that checks to see if I have placed any updated files on my server and if so download them and alert the user rather than pushing out the notification to hit the update button.

Mikey
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 755
Joined: Fri Jun 27, 2008 9:00 pm

Re: Push Notifications Examples

Post by Mikey » Thu Jul 17, 2014 2:14 pm

The Push ID is not a device ID. It is an app-specific ID that will be current for at max two years before it will change. In order to avoid trouble, you may want to check each time your app launches to ensure that the push id has not changed, and if it has, to notify your server.

ALSO, on the server side, you are supposed to check once per day to see if a device has revoked push permissions, because Apple gets a little testy if you keep pushing out notifications to a device that has revoked them.

Yes, as an alternative, you can just check your server to see if anything updated. For corporate apps, that should be sufficient, except for the seconds it takes to check for an update. Since LC exits when it suspends, unless you have tweaked that setting, your app might waste your users' time. It can come down to a matter of how often you do updates, and the coolness factor, because at least in our experience, our users break into a little smile when we send them a push, especially if they're with a customer. It sort-of rubs it in that we have corporate apps and they don't.

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: Push Notifications Examples

Post by FireWorx » Thu Jul 17, 2014 7:55 pm

Thanks, sounds like I was way off base. Thanks again for some clarity!

Post Reply

Return to “iOS Deployment”