Page 1 of 1
GPS based push notifications
Posted: Wed Jan 23, 2013 4:38 pm
by bsod99
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!
Re: GPS based push notifications
Posted: Wed Jan 23, 2013 5:23 pm
by dave_probertGA6e24
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
Re: GPS based push notifications
Posted: Wed Jan 23, 2013 5:39 pm
by bsod99
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?
Re: GPS based push notifications
Posted: Wed Jan 23, 2013 10:28 pm
by Simon
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
Re: GPS based push notifications
Posted: Thu Jan 24, 2013 11:53 am
by bsod99
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.
Re: GPS based push notifications
Posted: Thu Jan 24, 2013 12:12 pm
by bsod99
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?
Re: GPS based push notifications
Posted: Thu Jan 24, 2013 9:37 pm
by Simon
Re: GPS based push notifications
Posted: Mon Jan 28, 2013 9:34 am
by monte
Just making sure you guys have seen one of my new externals that does this on iOS. More info at
http://mergExt/home/mergCL