RSS Reader Template for Corona SDK


Warning: fopen(/home/rmiracle/public_html/wp-content/plugins/devformatter/geshi/geshi/lua.php): failed to open stream: No such file or directory in /home/omnigeek/public_html/wp-content/plugins/devformatter/devgeshi.php on line 103

Warning: fopen(/home/rmiracle/public_html/wp-content/plugins/devformatter/geshi/geshi/lua.php): failed to open stream: No such file or directory in /home/omnigeek/public_html/wp-content/plugins/devformatter/devgeshi.php on line 103

Warning: fopen(/home/rmiracle/public_html/wp-content/plugins/devformatter/geshi/geshi/lua.php): failed to open stream: No such file or directory in /home/omnigeek/public_html/wp-content/plugins/devformatter/devgeshi.php on line 103

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 display
03
--
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 a
07
-- call back function, that will start the download.  Once the download is 
08
-- donn, another call back will trigger the parsing of the RSS feed, then when
09
-- 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 use
11
-- 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 same
15
-- parser won't deal with both feeds.  So you can substitude 
16
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 information
22
    -- a member of that table, named items, is a table with each story returned
23
    -- 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.items
31
        print("Num stories: " .. #stories)
32
        print("Got ", #stories, " stories, now show the tableView")
33
        showTableView()
34
    end
35

$99.99