1
votes

There are many examples out there for RSS readers but I am trying to find an example that employs alerts when new items in the rss feed become available.

I've found this Android open source rss reader which seems like a good base to start with. How could I adapt this rss reader to alert the user when a new item became available. The only way I could think to alert the user is setting a service to grab the rss in the background and them compare the two arrays to see if they match. But this may be more complex than my skills are.

Where can I find an example project of an RSS reader with alerts or how can I adapt an open source Android rss reader to have alerts.

2

2 Answers

0
votes

I don't know a library that actually do what you need but you can achieve what you want following this steps:

  • In a standard RSS you always have a date per item. Keep in mind this.
  • The first time you parse the RSS with any library you want, extract the date of the last item. This can be done by storing the date on first user access to feed or with a background service polling the URI.
  • Store (in SQLlite, SharedPreferences or file ) the last date.
  • Poll periodically with a backrground service the URL looking for new items using the stored date.
  • If there are new items, show an alert.(Status Bar is a good pattern choice for that).
  • Every time you find new items (or better, every time the user really access feed items), remember to replace the old stored date by the new "most new one".

Only if you feel confident, you can complement my status bar suggestion with the brand new Google Cloud Messaging, wich is a more elegant way to notify users: http://developer.android.com/guide/google/gcm/index.html

Hope this gives you an idea of what can you do.

PS: For RSS I found that this library goes very well with Android and I'm using it myself in several projects. https://github.com/ahorn/android-rss/