Ready to Buy Subscription, But Unclear If I Can Create XML Checker Alert App With Corona

Hello and good day,

I discovered Corona last week and spent the weekend watching tutorials, getting a “Hello World” app going and tweaking some of the sample apps to learn more advanced stuff. I however still am not clear if I can use Lua and Corona to create an app that checks what state you are in, checks if the xml file is updated every 4 hours, checks the xml file for information based on that state, and sends a notification (alert) if there is an update.

Can someone envision this kind of process being possible using Corona? I found some XML parsing examples in the SDK, and I think I saw an Alert example, but that’s as far as I got. Getting state information would require the GPS api to figure out what area you are in and attach that to a state and checking for file updates I don’t have a clue on how to do, unless I was downloading the file and then doing a compare constantly. May require a cron job.

Any insight would be helpful in making my decision.

Thanks [import]uid: 77632 topic_id: 12858 reply_id: 312858[/import]

So far I haven’t found a way to put it all together. [import]uid: 77632 topic_id: 12858 reply_id: 47877[/import]

Well iOS devices don’t have an exposed cron job and there Corona SDK apps won’t run in the background. Besides you have to keep your GPS checking to a minimum because it kills battery power.

Just to make sure, when you are saying “state” you are referring to a geographical state, like Kentucky or Ohio, not a computer state, like “active”, “moving”, “On/off” etc right?

So your app needs to determine where you are, check to see if an XML file has been updated and if so, download it, parse it and show the data?

You can use Corona SDK to get your current lat, long from the GPS, then using the map api, do a reverse geocode to get the state/region information,

Then you can use the http asysnc requests api’s to fetch on demand the XML file for the region you need it for and parse it.

now depending on how much control you have on the server side, lets say you have a PHP script that’s building the XML file that’s returned, you could pass it a parameter when you request the XML for your state with the time you last requested it (and you can save that in a local settings file) and the PHP script could be smart enough to only send the data if its newer than your last request.

Corona SDK is very capable of doing all of that. [import]uid: 19626 topic_id: 12858 reply_id: 47880[/import]

Hey Rob, I forgot to say thank you.

Yes, the states I’m talking about are the 50 states.

I have written a PHP file that checks for the updated file, both for a new file date and file size. I can run a cron job on the server to run that php file every 4 hours and post the appropriate data - now I will just need to figure out how to get the app to run in the background and check every 4 hours for a trigger which is set if there is new data. If so, then shoot off the alert with that new data from the stored zip code.

I had to travel cross-country twice over the last 10 days so I hadn’t had a chance to do more, but I wanted to thank you again for the response. [import]uid: 77632 topic_id: 12858 reply_id: 49643[/import]

I think you’re going to find Corona SDK may not be the tool for what you want to do. Apple limits what apps can run in the background and unless you’re jailbroken, its going to be difficult to get that background processing time and even then Corona probably can’t do it. There is also the push notification route, but Corona probably can’t do that either (I’ve never done a push app before, so I may not know what I’m talking about, but it makes sense)

Why do you need to update the phone on a schedule any way? Wouldn’t it be prudent to just check for updates when you start the app or return from a Suspend event?

Simply store the value of the last fetch, have a php function that returns the last update time, if its newer, download the file. [import]uid: 19626 topic_id: 12858 reply_id: 49768[/import]