Pull available text from server to app

Hi All,

I am trying to make it so that when the user opens up one of my apps, it pushes a default pop up alert to the user notifying them of my new game.

Below is the default code for the alert as found on the corona documentation which I am using:

– Handler that gets notified when the alert closes
local function onComplete( event )
if event.action == “clicked” then
local i = event.index
if i == 1 then
– Do nothing; dialog will simply dismiss
elseif i == 2 then
– Open URL if “Learn More” (second button) was clicked
system.openURL( “App URL Here [3]” )
end
end
end

– Show alert with two buttons
local alert = native.showAlert( “[1]”, “App description will go here [2]”, { “OK”, “Learn More” }, onComplete )

Basically, I would like it so that in the three fields, labeled with the 1, 2, & 3, will pull information from a file on my server (json?), which will then be interpreted and filled into the code. This way, I will be able to simply change up the text file on my server and have the new app automatically notify existing users.

I know this is kind of complex, but if anybody has any ideas how to do this (maybe there’s a tutorial somewhere?), I would really appreciate it.

Thanks!

Hi,

Take a look at:

https://docs.coronalabs.com/api/library/network/download.html

https://docs.coronalabs.com/api/library/json/decode.html

It’s a very common use case.

Cheers,

Chris

Hi, Thank you very much for the reply. I will try to get this to work today, if not I will post my code here once I get access to my computer. Thanks

Hi,

Take a look at:

https://docs.coronalabs.com/api/library/network/download.html

https://docs.coronalabs.com/api/library/json/decode.html

It’s a very common use case.

Cheers,

Chris

Hi, Thank you very much for the reply. I will try to get this to work today, if not I will post my code here once I get access to my computer. Thanks