0

I'm working on adding a YouTube channel to my Android App and I'm having difficulty figuring out how to go about doing this. I'm currently learning about SyncAdapters by looking at the Android "SampleSyncAdapter" sample.

I would want the SyncAdapter to update my app's database with the YouTube meta-data and thumbnail so I could display that in a ListView. There is no need to authenticate the user or have them register for the sync as the videos are public domain. There is no need to feedback information from the viewer to YouTube. I simply want my app to only show the videos for my channel and not others. The SyncAdapter's job is to load new videos into the database on a regular basis, perhaps once a day.

I ran the "SampleSyncAdapter", but it seems to make the user sign up with a username and password. It also seems to have broken my ability to add Contacts, even after I uninstalled it.

It would not be acceptable to force the user to register to get the videos. The videos should be there when the user first installs the app and not need any extra steps.

Can anyone tell me if using a "SyncAdapter" is a good idea?

Mitch
  • 1,716
  • 3
  • 25
  • 41
  • Not a duplicate but related question [Should I use android AccountManager?](http://stackoverflow.com/a/8614699/94363) – rds Dec 23 '11 at 10:17

1 Answers1

3

Yes a SyncAdapterrequires an AccountAuthentificator, even if it's a dumb one.

If you try to avoid it, your application or the Sttings application will crash, and not necessarly in an understandable way.

You can also work with a Service and AlarmManager, but I suppose the SyncAdapter is better design:

  • it will manage online/offline state for you
  • user can start/stop synchronization in the Settings
rds
  • 26,253
  • 19
  • 107
  • 134
  • OT: This is in my list of [things that s*ck in the Android framework](http://regis.decamps.info/blog/2011/08/my-life-with-android-its-complicated/) – rds Dec 14 '11 at 09:22
  • So by "dumb one", how dumb can it be? Can it be so dumb the user doesn't know it's there and doesn't need to do anything? – Mitch Dec 14 '11 at 20:01
  • Yes, from what I recall, you can start with an `AbstractAccountAuthentificator` and return `null` for all methods that must be implemented. The user won't have to enter any user/password, but the object must be declared in the Manifest. – rds Dec 15 '11 at 08:58