RSS Podcast and Reader App
Fully functional application written for Corona SDK to set up an RSS reader for a website. It also handles pod-casts. Includes sample artwork that must be replaced with your own before building your app.
This template includes the following Corona SDK technologies in a well documented, easy to read, well organized source code:
- Widget based tabBar controller to show four screens with tab buttons at the bottom.
- Widget based tableView controller to show a list of items with a graphic, headline and functionality to access a page showing more information about the item.
- Code to check to see if the network is available, fetch an RSS feed from a server using network.request() utilizing the Caches directory.
- Parsing an RSS feed
- Parsing an Atom feed
- starter code for Push Notifications
- starter code/settings for making an app appear in the Newsstand
- Playing a podcast (or other Audio) in the background
- Accessing web pages.
- Using webViews to show your own local HTML content
- Storyboard
- Passing parameters between scenes.
- Making debugging print statements turn off for production code with one flag
- Can use embedded images in the feed for listView icons.
The template includes the following source files:
- main.lua — contains tabBar Controller setup and use.
- feed.lua — does most of the work. It downloads the RSS feed, uses the rss.lua module to return a table that represents the feed and populates a tableView.
- podcast.lua, webpage.lua — both files do basically the same thing. They show the contents of an individual story which puts HTML in a local file to show in a webView. podcast.lua provides a play button to play the podcast, webpage.lua’s button loads the actual website into the web browser.
- rss.lua, atom.lua — these two files parse each of the individual feed types.
- xml.lua — needed to parse the downloaded RSS file.
- config.lua, build.settings, support graphics and widget library support files.
Sample Code
lua |copy code |?
01 02 -- function to fetch the feed, parse it and setup the display03 --04 -- This has to be read kind of backwards based on the flow of things.05 --06 -- First, we need to check for network avaialbility. That will trigger a07 -- call back function, that will start the download. Once the download is08 -- donn, another call back will trigger the parsing of the RSS feed, then when09 -- that is done, the tableView is loaded up with entries and displayed.10 -- if the network is unavialable or if the downloas fails we will try to use11 -- the cached version of the file.12 --13 -- I should point out that this system supports both RSS2.0 and Atom feeds.14 -- Both are RSS feeds, but they are slightly different and enough that the same15 -- parser won't deal with both feeds. So you can substitude16 function displayFeed(feedName, feedURL)17 18 print("entering displayFeed", feedName, feedURL)19 20 --21 -- this will process the file and return a table with the feed information22 -- a member of that table, named items, is a table with each story returned23 -- from the feed.24 -- Then we initialize the tableView.25 --26 local function processRSSFeed(file, path)27 print("Parsing the feed")28 local story = {}29 local feed = rss.feed(file, path)30 stories = feed.items31 print("Num stories: " .. #stories)32 print("Got ", #stories, " stories, now show the tableView")33 showTableView()34 end35