SyncAdapter没有一个帐户 [英] SyncAdapter Without an Account

查看:194
本文介绍了SyncAdapter没有一个帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图创建一个SyncAdapter我的Andr​​oid应用程序从一个特定的频道显示YouTube视频。该影片是公共领域,所以我不希望用户登录,创建一个帐户,进行自我验证,上传数据,或使用联系人数据库。我只是想SyncAdapter定期更新与该频道的最新视频元数据,我的应用程序的数据库。我已经建立了一个ContentProvider的访问我的数据库。我不喜欢的事实,SyncProvider都将处理关闭同步,日程安排,并重新回退机制,更新的能力。

I'm trying to create a SyncAdapter for my Android app to show YouTube videos from one specific channel. The videos are public domain so I don't want the user to login, create an account, authenticate themselves, upload data, or use the contacts database. I simply want the SyncAdapter to periodically update my app's database with the newest video metadata from that channel. I already built a ContentProvider to access my database. I do like the fact that the SyncProvider will handle the ability to turn off syncing, scheduling, and retry backoff mechanisms for updating.

我刚才问一个SyncAdapter是对我的使用情况下,一个不错的选择,我被告知这是。我看着谷歌I / O视频,阅读文档,阅读博客...(请参见下面的列表)。我一直无法得到任何工作。我已经得到了最好的是让SyncAdapter帐户出现在全球的帐户与同步设置,而是被非功能。即使这个工作,这将是不太理想的,因为我preFER用户看不到,除非从内我的应用程序的帐户。如果没有其他选择,这是可以接受的,只要他们不需要访问它来设置它为一切都将默认为自动每天一次同步。

I asked earlier if a SyncAdapter was a good choice for my use case, and I was told it was. I watched the Google I/O video, read the docs, read blogs... (see list below). I've been unable to get anything to work. The best I've gotten was to have the SyncAdapter account show up in the global "Accounts & sync settings" but be non-functional. Even if this worked, it would be less than ideal because I prefer the user to not see the account except from inside my app. This would be acceptable if there was no other option, so long as they don't need to access it to set it up as everything would default to automatic once a day syncing.

我甚至尝试使用SampleSyncAdapter原样,把断点在身份验证code部分。没有一个命中断点,所以我看不到有什么触发了呼叫还是什么数据都包含。我还以为我至少可以得到那么多。

I even tried to use the SampleSyncAdapter as-is and put breakpoints in the Authentication code sections. Not a single breakpoint is hit so I can't see what triggers the calls or what data is contained. I would have thought I'd at least get that much.

我开始想到用一个SyncAdapter是,尽管推荐一个坏主意。我还没有找到一个例子是接近我想要的,更何况是一个教程或完整的,有组织,有清晰的文档。这似乎是它应该是一个共同的任务,许多应用程序会想这样做。

I'm starting to think using a SyncAdapter is a bad idea despite the recommendation. I've yet to find an example that is close to what I want, let alone a tutorial or complete, organized and clear docs. This seems like it should be a common task many apps would want to do.

请加入到这个职位有什么好的文件在这个用例。我能找到没有。
没有这一点,我认为这是公平地推荐给大家不使用SyncAdapters这个用例。我不是说其他​​的用例在这里,所以不跳就与它的工作原理为您的使用情况下,如果它不喜欢我的。

Please add to this post any good documentation on this use case. I can find none.
Without this, I think it's fair to recommend to everyone to not use SyncAdapters for this use case. I'm not speaking for other use cases here so don't jump on with how it worked for your use case if it's not like mine.

这也将是有益知道什么版本的API级别被认为是准备好黄金时段。有一些关于发布版本号的问题。我试图保持尽可能低的水平,以获得最大的用户。我现在的API的目标是7。

It would also be helpful to know what version of the API level is considered ready for primetime. There's a number of issues posted regarding version numbers. I'm trying to stay as low as possible to get the most users. My current API target is 7.

下面的链接我已经试过无济于事名单,其他人可能觉得这些比较有帮助:

Here's list of links I've tried to no avail, others may find these more helpful:

<一个href="http://developer.android.com/resources/samples/SampleSyncAdapter/index.html">http://developer.android.com/resources/samples/SampleSyncAdapter/index.html

<一个href="http://www.google.com/events/io/2010/sessions/developing-RESTful-android-apps.html">http://www.google.com/events/io/2010/sessions/developing-RESTful-android-apps.html

<一个href="http://naked-$c$c.blogspot.com/2011/05/revenge-of-syncadapter-synchronizing.html">http://naked-$c$c.blogspot.com/2011/05/revenge-of-syncadapter-synchronizing.html

<一个href="http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-1/">http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-1/

<一个href="http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-2/">http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-2/

<一个href="http://www.finalconcept.com.au/article/view/android-account-manager-step-by-step">http://www.finalconcept.com.au/article/view/android-account-manager-step-by-step

<一个href="http://www.finalconcept.com.au/article/view/android-account-manager-step-by-step-1">http://www.finalconcept.com.au/article/view/android-account-manager-step-by-step-1

<一个href="http://www.finalconcept.com.au/article/view/android-account-manager-step-by-step-2">http://www.finalconcept.com.au/article/view/android-account-manager-step-by-step-2

<一个href="http://stackoverflow.com/questions/5368163/android-syncadapter-without-authentication-vs-android-service">Android SyncAdapter没有验证与Android的服务

<一个href="http://stackoverflow.com/questions/5253858/why-does-contentresolver-requestsync-not-trigger-a-sync">Why并ContentResolver.requestSync不会触发同步?

推荐答案

在简短的答案是:的ContentProvider 的AccountManager SyncAdapter 一起去。你必须有这三件,即使他们是愚蠢的。

In short the answer is: ContentProvider, AccountManager and SyncAdapter go together. You must have these three pieces, even if they are "dumb".

这篇关于SyncAdapter没有一个帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆