Question

I'm a .Net developer working on my first Android app. I am struggling with the learning curve, and I was hoping someone could give me a push in the right direction; I've found so many tutorials that don't quite fit what I want to do and I'm having a hard time trying to piece something together.

I am working on an app that will be conceptually very much like an RSS reader. It displays a list of items, and clicking on one item displays item detail. I have this working and using dummy data.

The real data will come from a REST service. Like an RSS reader, I want my app to poll periodically and refresh itself with the latest data. It will also have a Refresh button so that the user can refresh on demand between polling cycles.

I want it to poll even if the user has not manually launched the app; much like the Twitter or Facebook apps. In this case, when new data is found, a notification would be shown, and clicking on the notification would launch the app, where the user would find the newly-found data waiting to be viewed.

I think I need a service that runs when the device is booted. The service would poll the REST service periodically. When it finds new data, it would throw up the notification, which would be configured to launch the app.

I think the app would communicate with the service to receive the chunk of new data. I think the app would also be able to communicate with the service to tell it to poll on demand (if the user wishes to refresh).

I'm sure this is garden-variety stuff for someone with a little experience, but for me it is rather daunting at this point. I just need an outline of the pieces I need to put this together. Pointers to any tutorials that closely match what I am trying to do would be a plus. Thanks!

Was it helpful?

Solution

You need a sync adapter, which is a background service that runs when the device deems it an appropriate time to sync. There is a Google I/O best practice video and my own advice on how you should do this. You can find that data here http://blog.ericwoodruff.me/2013/09/android-remote-sync-content-provider.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top