Question

I'm designing an application for getting some data from a web service, like a REST API and showing it to the user:

I was thinking about using the Sync Adapter with Content Provider API:

  1. the Sync Adapter handles the data flow between the local DB and remote DB.
  2. the content provider API loads the data into the UI.

My question is that the remote application, if, has a server push support (using Socket.IO or so), how should I design the app to exploit this feature? because as far as I understand, when the SyncAdapter will run is determined by SyncManager. So I can't ensure that the sync is done only when the server pushes. I wanted to know if this is possible, even without running the application in the foreground or background. i.e., only with the sync adapter running.

thanks in advance for any replies.

PS: I'm just starting to design android apps, so forgive me/correct me if I'm wrong.

Follow up:

  1. I'm not interested in the Cloud messaging APIs (like GCM). I wanted to keep the data private if the user wishes to.
Was it helpful?

Solution

If your application will be running for a while you don't really want to keep a constant connection open to a server since that will eat a lot of batteries.

It sounds like you're looking for this: http://developer.android.com/google/gcm/index.html

Using gcm your app can get a notification when there's an update on your server.

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