用于公共领域信息的一种 Android SyncAdapter

发布于 2024-12-20 22:23:02 字数 492 浏览 2 评论 0原文

我正在努力将 YouTube 频道添加到我的 Android 应用程序中,但我很难弄清楚如何执行此操作。我目前正在通过查看 Android“SampleSyncAdapter”示例来了解 SyncAdapter。

我希望 SyncAdapter 使用 YouTube 元数据和缩略图更新我的应用程序的数据库,以便我可以在 ListView 中显示它。由于视频属于公共领域,因此无需对用户进行身份验证或让他们注册同步。观看者无需向 YouTube 反馈信息。我只是希望我的应用程序仅显示我频道的视频,而不显示其他频道的视频。 SyncAdapter 的工作是定期(也许每天一次)将新视频加载到数据库中。

我运行了“SampleSyncAdapter”,但它似乎让用户使用用户名和密码进行注册。即使我卸载了它,它似乎也破坏了我添加联系人的能力。

强迫用户注册才能获取视频是不可接受的。当用户首次安装应用程序时,视频应该就在那里,不需要任何额外的步骤。

谁能告诉我使用“SyncAdapter”是否是一个好主意?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深海夜未眠 2024-12-27 22:23:02

是的,SyncAdapter需要一个AccountAuthentificator,即使它是一个愚蠢的。

如果您尝试避免它,您的应用程序或 Sttings 应用程序将会崩溃,而且不一定以可理解的方式崩溃。

您还可以使用 ServiceAlarmManager,但我认为 SyncAdapter 是更好的设计:

  • 它将为您的
  • 用户 管理在线/离线状态可以在设置中开始/停止同步

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文