没有帐户的同步适配器

Sync Adapter without Account(没有帐户的同步适配器)

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

问题描述

我需要从我的应用中通过云获取一些数据.我在 RESTful android 应用程序@http://www.youtube.com/watch 上观看了 google IO 视频?v=xHXn3Kg2IQE&t=43m58s 建议在最终幻灯片中使用 SyncAdapter 与 Android 系统集成.

I need to fetch some data over the cloud from my app. I've watched the google IO video on RESTful android apps @ http://www.youtube.com/watch?v=xHXn3Kg2IQE&t=43m58s It recommends in the final slides to use a SyncAdapter to integrate with the Android System.

后来我了解到必须使用帐户来实现 SyncAdapter.我的应用程序不使用帐户.用户无需注册即可自由下载数据.我还能使用 SyncAdapter 吗?有没有我可以使用的股票虚拟账户?

Later I learned that one has to use an Account to implement SyncAdapter. My app does not use an account. Users can freely download data without registration. Can I still use SyncAdapter? Is there a stock dummy account that I could use?

我的应用确实有内容提供商,所以这不是问题

I do have a content provider for my app so that's not a problem

Edit2:我刚刚查看了设置"->帐户和"下的天气"和股票"应用程序.同步.您可以看到它们允许同步,但没有删除帐户按钮.另一方面,谷歌、Facebook 和 Skype 应用程序允许同步 PLUS,它们有一个删除帐户按钮.这意味着 Weather 和 Stock 不使用帐户,而 Google、Facebook 和 Skype 使用.

I've just looked at the Weather and Stock apps under Settings -> Accounts & Sync. You can see that they allow syncing, but don't have a remove account button. On the other hand, Google, Facebook and Skype apps allow syncing PLUS they have a remove account button. This means Weather and Stock don't use accounts, whereas Google, Facebook and Skype do.

我找到的教程@http://ericmiles.wordpress.com/2010/09/22/connecting-the-dots-with-android-syncadapter/ 和@http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-1/ 这么说必须有一个帐户才能使用 Sync Adapter.:S???

The tutorials I found @ http://ericmiles.wordpress.com/2010/09/22/connecting-the-dots-with-android-syncadapter/ and @ http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-1/ say that one MUST have an account to use Sync Adapter. :S ???

推荐答案

我创建了一个联系人同步适配器,但我没有帐户授权和/或配置屏幕.这并不难.我不认为必须处理 Android 帐户的东西是什么大不了的事.

I have created a contact sync adapter where I don't have a account authorization and or configuration screens. It wasn't that hard. I don't think having to deal with the Android Account stuff was that much of a deal.

引用您的教程链接:

坏消息是没有库存"功能为您提供提供帐户的简单方法系统.但是,在同一个 Sync附带的适配器示例SDK里面有很多代码可以借给你账户功能.除非你想要一个自定义凭据屏幕,您可以盗取所有代码com.example.android.samplesync.authenticator包只做了一些小改动.

The bad news is that there is no "stock" functionality to give you an easy way to provide an Account to the system. However, in the same Sync Adapter Example that comes with the SDK there is a lot of code you can borrow to give you Account functionality. Unless you desire a custom credentials screen, you can heist all the code in the com.example.android.samplesync.authenticator package with only a few minor changes.

所以它基本上只是示例中的复制和粘贴,这几乎就是我所做的并且效果很好.

So it's basically just a copy and paste from the example, that's pretty much what I did and it worked fine.

我不确定,但所有没有删除帐户"的适配器似乎都是我查看过的所有设备上的内置 ROM 适配器.我不确定你是否需要担心.

I don't know for sure but all the adapters that don't have "Remove Account" seems to be built-in ROM adapters on all the devices I've looked at. I'm not sure you have to worried about it.

这篇关于没有帐户的同步适配器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:没有帐户的同步适配器

基础教程推荐