GPS based push notifications

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
bsod99
Posts: 6
Joined: Wed Jan 23, 2013 4:27 pm

GPS based push notifications

Post by bsod99 » Wed Jan 23, 2013 4:38 pm

Hello, first post here. I'm about to start a project for deployment on iOS and Android, most likely with LiveCode, which will involve push notifications being sent to users (via PHP/web) and only displayed to users if they are in a certain area (doesn't have to be too exact). Is it possible to do this via LiveCode - where the notifications are pushed from the web server, then the application can use GPS to detect where the notification should be displayed or not? Many thanks for any pointers!

dave_probertGA6e24
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 328
Joined: Mon Dec 05, 2011 5:34 pm
Contact:

Re: GPS based push notifications

Post by dave_probertGA6e24 » Wed Jan 23, 2013 5:23 pm

Hi,

Welcome to the forums.

There are mobile functions for the use of GPS and they usually bring back basically numbers for latitude and longitude (mobileCurrentLocation, etc). These values can easily be checked if they fall within a rectangle of other Lat/Long values - or, with very little extra work, within a radius of a single lat/long.

The harder part is the background task aspect of an app that should receive the push notifications (assuming they arrive at unknown times). I'm sure there has been a few discussions about this on these forums somewhere.

Depending on your needs though, it might be easier to have the App request any items based on a pull from the server - where the App sends the request and the server sends back only those results that are relevant - then it might result in less bandwidth as the server is not sending data when the App isn't running.

Of course, the actual requirements of your App will define which is the better route.

Cheers,
Dave
Coding in the Sun - So much Fun.
Visit http://electronic-apps.info for released App information.

bsod99
Posts: 6
Joined: Wed Jan 23, 2013 4:27 pm

Re: GPS based push notifications

Post by bsod99 » Wed Jan 23, 2013 5:39 pm

Hi Dave, cheers for the reply!

I think your suggestion of making a call to the server for notifications could fit my use case. Essentially, when people are in a location, the idea is to send notifications to them about special offers etc. Am I right in thinking the app could determine through GPS when to make the call to the server, then retrieve the notification content (may be several, which might need some form of queuing) and use local notifications to display to the user?

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: GPS based push notifications

Post by Simon » Wed Jan 23, 2013 10:28 pm

Am I right in thinking the app could determine through GPS when to make the call to the server
I believe this has to be a user task.
They should click a button (or run your app) "Any sales near me?" Which would start the server communication.
Running the GPS full time is very power consuming and you wouldn't want it to run all day. I guess you could do a bunch of math based on current location vs distance to next sale and traveling speed to turn the GPS on and off.

But lets say this app is shopping mall specific. They get to a mall and only stores within that mall are part of your target sales. That could work.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

bsod99
Posts: 6
Joined: Wed Jan 23, 2013 4:27 pm

Re: GPS based push notifications

Post by bsod99 » Thu Jan 24, 2013 11:53 am

Simon wrote:
Am I right in thinking the app could determine through GPS when to make the call to the server
I believe this has to be a user task.
They should click a button (or run your app) "Any sales near me?" Which would start the server communication.
Running the GPS full time is very power consuming and you wouldn't want it to run all day. I guess you could do a bunch of math based on current location vs distance to next sale and traveling speed to turn the GPS on and off.

But lets say this app is shopping mall specific. They get to a mall and only stores within that mall are part of your target sales. That could work.

Simon
I think, the user would be prompted to run the app upon admission to the area - at which point the GPS detection would run, check if meets location conditions, then make request to server for available notifications. Ideally the notifications could be queued and sent individually as local notifications at intervals? They would probably collated too and made available to the user on a page in the app.

bsod99
Posts: 6
Joined: Wed Jan 23, 2013 4:27 pm

Re: GPS based push notifications

Post by bsod99 » Thu Jan 24, 2013 12:12 pm

Just alluding to what Dave mentioned, the ability to receive push notifications when the app is running the background (for iOS and Android this would be) - is this possible? If the user launches the app, the GPS detection is run and the user is in the relevant location, can the GPS check and push notifications both run while the app is running in the background?

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: GPS based push notifications

Post by Simon » Thu Jan 24, 2013 9:37 pm

I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: GPS based push notifications

Post by monte » Mon Jan 28, 2013 9:34 am

Just making sure you guys have seen one of my new externals that does this on iOS. More info at http://mergExt/home/mergCL
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

Post Reply