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
-- function to fetch the feed, parse it and setup the display
--
-- This has to be read kind of backwards based on the flow of things.
--
-- First, we need to check for network avaialbility. That will trigger a
-- call back function, that will start the download. Once the download is
-- donn, another call back will trigger the parsing of the RSS feed, then when
-- that is done, the tableView is loaded up with entries and displayed.
-- if the network is unavialable or if the downloas fails we will try to use
-- the cached version of the file.
--
-- I should point out that this system supports both RSS2.0 and Atom feeds.
-- Both are RSS feeds, but they are slightly different and enough that the same
-- parser won't deal with both feeds. So you can substitude
function displayFeed(feedName, feedURL)
print("entering displayFeed", feedName, feedURL)
--
-- this will process the file and return a table with the feed information
-- a member of that table, named items, is a table with each story returned
-- from the feed.
-- Then we initialize the tableView.
--
local function processRSSFeed(file, path)
print("Parsing the feed")
local story = {}
local feed = rss.feed(file, path)
stories = feed.items
print("Num stories: " .. #stories)
print("Got ", #stories, " stories, now show the tableView")
showTableView()
end
