4

I don't wish to use authentication with my sync adaptor Since I plan to use it for syncing twitter public timeline for a search query.

Shall I use SyncAdapter or any ordinary Service?

Taranfx
  • 10,361
  • 17
  • 77
  • 95

1 Answers1

1

Either would work fine in this use case.

If your application might contain multiple user accounts, then going the SyncAdapter/Account route would be best as it would maintain the standard account management procedures (you can have accounts without authentication).

Using a SyncAdapter will also mean Android automatically syncs your data as needed.

With a standard service you'd need to set up the functionality if you wanted it to sync automatically every X minutes in the background, but apart from that it would be just as easy - though you'd need to do your syncing in a different thread (e.g. use an AsyncTask, I think using a SyncAdapter will do this automatically).

Joseph Earl
  • 23,351
  • 11
  • 76
  • 89
  • Thanks for the answer. Have you seen any example that uses SyncAdapter with an application (other than SampleSync Adapter)? – Taranfx Mar 21 '11 at 18:54
  • No because it is very badly documented -- to quote an Android platform developer "There is no real support for sync in the SDK." [1]. For instance in the `ContentResolver` class the `requestSync` method states "Start an asynchronous sync operation. If you want to monitor the progress of the sync you may register a SyncObserver." Except there is no public `SyncObserver` class [2]. For this reason for app I am developing for a client I chose to use my own service so I had more control. – Joseph Earl Mar 21 '11 at 20:42
  • Links: [1] http://groups.google.com/group/android-developers/browse_thread/thread/e9ff446f078c7cd0 [2] http://code.google.com/p/android/issues/detail?id=6772developers/browse_thread/thread/e9ff446f078c7cd0 – Joseph Earl Mar 21 '11 at 20:45
  • In fact yes, I have, but it is pretty much the same as the SampleSyncAdapter demo: http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-2/ – Joseph Earl Mar 21 '11 at 20:47