Domanda

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?

È stato utile?

Soluzione

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
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top