Android Samples 之 basicsyncadapter

basicsyncadapter 

This sample demonstrates how to implement a sync adapter to fetch background data for an app that doesn't require a user-visible account type or two-way synchronization.

The sample periodically downloads the feed from the Android Developers Blog and caches the data in a content provider. At runtime, the cached feed data is displayed inside a ListView.

To learn more about creating and using sync adapters, see Transferring Data Using Sync Adapters.

Note: Sync adapters run asynchronously, so you should use them with the expectation that they transfer data regularly and efficiently, but not instantaneously. If you need to do real-time data transfer, you should do it in an AsyncTask or an IntentService.


翻译:

基础同步适配器

这个例子展示怎么样实现一个同步适配器去为App获取后台数据,该App不要求(与服务端)可见用户类型或者双向同步。

学习更多关于创建和使用同步适配器,去看看Transferring Data Using Sync Adapters【http://developer.android.com/training/sync-adapters/index.html】

Note:同步适配器是异步执行的,所以你应该在期望它可以定期地有效地但不是瞬间地传输数据时使用它。如果你想要实时地传输数据,那么你应该在中AsyncTaskIntentService完成这一任务。


Transferring Data Using Sync Adapters【http://developer.android.com/training/sync-adapters/index.html】的翻译,请看http://www.cnblogs.com/jdneo/p/3654168.html 。大概浏览了以下,使用同步适配器框架,用到以下物件,要会用该框架,还真要细看翻译才行。

1.内容提供器ContentProvider:为本地数据定义的,同步适配器框架运行同步适配器时也会调用到,如果该App没有ContentProvider,这时同步适配器                                         会崩溃。
2验证器:同步适配器在同步数据时,设备存储会有一个账户,服务器存储端会有登录验证
3内容提供器:为app的本地数据定义了内容提供器,
4服务Service:提供一个捆绑了验证器的服务Service,这一服务提供一个Android binder对象,允许框架调用你的验证器,并且在验证器和框架间传输数据。
5元数据文件:为框架提供组件描述,将你的验证器组件等插入到同步适配器和账户框架中。
6同步适配器:封装在设备和服务器之间传输数据的任务代码
7 清单文件: 列出该应用对于Android系统来说以上那些非常重要的信息。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值