Hi, i made a lot of games with corona, but now i have a problem to create a bussines app, i need something that i can update from remote, like “news”… so i can update them without updating the app…i searched a bit and i think this is can be made with server or i’m wrong? Firebase, Coronium and what else? someone can help me giving some idea on how i have to do? What plugin is better to use?
Most news apps have a web page that drives them. Most news sites offer a “News feed”. This will typically be using a common technology like RSS. Apps can fetch a sites RSS feed for a given section and take the inbound XML (RSS is just a well-defined XML document). You can then pull things like the title, description, URLs to images out of the feed text and display them with Corona.
Before you consider something like Firebase or Coronium, you need to ask yourself, how much of what you do will be content creation? Who will be creating content for the site? What tools will they use to do so?
At the simplest setup, many people would use a content management system like Wordpress to set up simple sites. Then your content creators have easy-to-use tools to add content to the site. Firebase and Coronium are storage tools and are very effective at what they do, but unless you’re skilled at using database table editors.
You can grab our business app sample from our github repo here: https://github.com/coronalabs-samples
It shows you how to fetch a feed, show the content in a tableView and then for individual stories show their content on a detail page.
Rob
Thanks for reply, here is what i really need to do:
This is an app for my city so i need
1)a news feed that i can take from an other web site or by creating a support-site like you say
2)a calendar of events that can be easly updated, this feature i can also do with rss i think if i understood
3)make surveys to citizens, and this i have no idea how to do?
4)give to users a possibility to make reports, like a hole in the street or a broken tree…possibly with a photo…and this i think can be made with an e-mail, but it will be better if there are a better way?
and also a city description but this is simply can be made with rss to
For #1, you will need to work with the City. They likely post news to their web site, but they may need to make sure to provide an RSS feed, which they may not.
For #2, again, you are probably going to be restricted to the tools they use to create their events, but an RSS feed if they have it would be simple.
For #3, this is likely going to be the most challenging for the city, but may be pretty easy for you. They will need to find a survey system, like Survey Monkey (https://www.surveymonkey.com/) because they may want to email surveys to people, give people access to the survey from their website, etc. Then for your app, just put the URL to the survey in a native.newWebView() and call it a day. You may need a way to get the URL of the current survey from the website, but that could be as simple as a text file that you could fetch with network.request().
#4 What methods does the city have to make the reports? This will be your decision maker. Do they have a form on their website? If so, it probably conforms to a standard HTTP Multi-part MIME standards, which means you can use network.request() and make a POST request to submit data to their collection form. You can setup various native.newTextFields() to collect input, and we have API’s to capture photos and as long as you meet the requirements of the web form, you should be able to do that. Of course falling back to email is a possibility.
Rob
Thanks for help Rob, this really help me. I will try these things in days and back soon
Thanks again, all of these thing worked perfectly!!!
Hi, the last thing, i just want to send an email with an image captured by camera, for now the working code is to send e-mails only with text fields, but how i can insert also an image in the e-mail?
?php $receiverMail = "mymail@gmail.com"; $name = ltrim(rtrim(strip\_tags(stripslashes($\_POST['name'])))); $email = ltrim(rtrim(strip\_tags(stripslashes($\_POST['email'])))); $place = ltrim(rtrim(strip\_tags(stripslashes($\_POST['place'])))); $subject = ltrim(rtrim(strip\_tags(stripslashes($\_POST['subject'])))); $msg = ltrim(rtrim(strip\_tags($\_POST['msg']))); $ip = getenv("REMOTE\_ADDR"); $msgformat = "Email: $email ($ip)\nSubject: $subject\nPlace: $place\n\nDescription: $msg"; // VALIDATION if(empty($name) || empty($email) || empty($subject) || empty($msg)) { echo "\<h3\>Email not sent \</h3\>\<p\>Try again\</p\>"; } elseif(!ereg("^[\_a-z0-9-]+(\.[\_a-z0-9-]+)\*@[a-z0-9-]+(\.[a-z0-9-]+)\*(\.[a-z]{2,3})$", $email)) { echo "Wrong e-mail adress"; } else { mail($receiverMail, $subject, $msgformat, "From: $name \<$email\>"); echo "\<h3\>Email sent!\</h3\>\<p\>thanks for contacting us\</p\>"; } ?\>
local headers = {} headers["Content-Type"] = "application/x-www-form-urlencoded" headers["Accept-Language"] = "it-IT" local body = "name="..var1.."&email="..var2.."&place="..var3.."&subject="..var4.."&msg="..var5 local params = {} params.headers = headers params.body = body network.request( "http://www.mywebsite.it/send.php", "POST", networkListener, params ) ... local onComplete = function( event ) print( "Returned from camera view." ) event.target.alpha = 0 --here's the file end media.capturePhoto( { listener = onComplete } )
Is that the actual Corona/Lua code you’re using? I don’t see where you are calling network.request() as the result of the photo being captured. Then in your network.request() code, I don’t see where you’re reading the image file, base64 encoding it and adding it to the body that you’re sending to the server.
Rob
Yeah…this is what i had any idea how to do…for that i have not code about reading image and encoding it and then sending to the php file…however i solved my problem by uploading the foto with network.upload in a folder on the server, without attach it to the mail…this solution was better for me. thanks
Hai,
The Code u wrote has worked for me perfectly. Thanks for sharing nice information. Here you can Look for more info of my website.
Thanks,
Riya.
Most news apps have a web page that drives them. Most news sites offer a “News feed”. This will typically be using a common technology like RSS. Apps can fetch a sites RSS feed for a given section and take the inbound XML (RSS is just a well-defined XML document). You can then pull things like the title, description, URLs to images out of the feed text and display them with Corona.
Before you consider something like Firebase or Coronium, you need to ask yourself, how much of what you do will be content creation? Who will be creating content for the site? What tools will they use to do so?
At the simplest setup, many people would use a content management system like Wordpress to set up simple sites. Then your content creators have easy-to-use tools to add content to the site. Firebase and Coronium are storage tools and are very effective at what they do, but unless you’re skilled at using database table editors.
You can grab our business app sample from our github repo here: https://github.com/coronalabs-samples
It shows you how to fetch a feed, show the content in a tableView and then for individual stories show their content on a detail page.
Rob
Thanks for reply, here is what i really need to do:
This is an app for my city so i need
1)a news feed that i can take from an other web site or by creating a support-site like you say
2)a calendar of events that can be easly updated, this feature i can also do with rss i think if i understood
3)make surveys to citizens, and this i have no idea how to do?
4)give to users a possibility to make reports, like a hole in the street or a broken tree…possibly with a photo…and this i think can be made with an e-mail, but it will be better if there are a better way?
and also a city description but this is simply can be made with rss to
For #1, you will need to work with the City. They likely post news to their web site, but they may need to make sure to provide an RSS feed, which they may not.
For #2, again, you are probably going to be restricted to the tools they use to create their events, but an RSS feed if they have it would be simple.
For #3, this is likely going to be the most challenging for the city, but may be pretty easy for you. They will need to find a survey system, like Survey Monkey (https://www.surveymonkey.com/) because they may want to email surveys to people, give people access to the survey from their website, etc. Then for your app, just put the URL to the survey in a native.newWebView() and call it a day. You may need a way to get the URL of the current survey from the website, but that could be as simple as a text file that you could fetch with network.request().
#4 What methods does the city have to make the reports? This will be your decision maker. Do they have a form on their website? If so, it probably conforms to a standard HTTP Multi-part MIME standards, which means you can use network.request() and make a POST request to submit data to their collection form. You can setup various native.newTextFields() to collect input, and we have API’s to capture photos and as long as you meet the requirements of the web form, you should be able to do that. Of course falling back to email is a possibility.
Rob
Thanks for help Rob, this really help me. I will try these things in days and back soon
Thanks again, all of these thing worked perfectly!!!
Hi, the last thing, i just want to send an email with an image captured by camera, for now the working code is to send e-mails only with text fields, but how i can insert also an image in the e-mail?
?php $receiverMail = "mymail@gmail.com"; $name = ltrim(rtrim(strip\_tags(stripslashes($\_POST['name'])))); $email = ltrim(rtrim(strip\_tags(stripslashes($\_POST['email'])))); $place = ltrim(rtrim(strip\_tags(stripslashes($\_POST['place'])))); $subject = ltrim(rtrim(strip\_tags(stripslashes($\_POST['subject'])))); $msg = ltrim(rtrim(strip\_tags($\_POST['msg']))); $ip = getenv("REMOTE\_ADDR"); $msgformat = "Email: $email ($ip)\nSubject: $subject\nPlace: $place\n\nDescription: $msg"; // VALIDATION if(empty($name) || empty($email) || empty($subject) || empty($msg)) { echo "\<h3\>Email not sent \</h3\>\<p\>Try again\</p\>"; } elseif(!ereg("^[\_a-z0-9-]+(\.[\_a-z0-9-]+)\*@[a-z0-9-]+(\.[a-z0-9-]+)\*(\.[a-z]{2,3})$", $email)) { echo "Wrong e-mail adress"; } else { mail($receiverMail, $subject, $msgformat, "From: $name \<$email\>"); echo "\<h3\>Email sent!\</h3\>\<p\>thanks for contacting us\</p\>"; } ?\>
local headers = {} headers["Content-Type"] = "application/x-www-form-urlencoded" headers["Accept-Language"] = "it-IT" local body = "name="..var1.."&email="..var2.."&place="..var3.."&subject="..var4.."&msg="..var5 local params = {} params.headers = headers params.body = body network.request( "http://www.mywebsite.it/send.php", "POST", networkListener, params ) ... local onComplete = function( event ) print( "Returned from camera view." ) event.target.alpha = 0 --here's the file end media.capturePhoto( { listener = onComplete } )
Is that the actual Corona/Lua code you’re using? I don’t see where you are calling network.request() as the result of the photo being captured. Then in your network.request() code, I don’t see where you’re reading the image file, base64 encoding it and adding it to the body that you’re sending to the server.
Rob
Yeah…this is what i had any idea how to do…for that i have not code about reading image and encoding it and then sending to the php file…however i solved my problem by uploading the foto with network.upload in a folder on the server, without attach it to the mail…this solution was better for me. thanks
Hai,
The Code u wrote has worked for me perfectly. Thanks for sharing nice information. Here you can Look for more info of my website.
Thanks,
Riya.