同步时发送和接收的格式是什么
我正在研究 Android 中的同步。 我从 sdk 中的示例中找到了一个示例,它工作正常。
例如,当他们从服务器接收数据时,他们使用以下协议。
[{"e": "[电子邮件受保护]", “f”:“测试”,“i”:“1709001”,“h”: “1-232-242-1829”,“m”:“1-232-242-1829”,“l”:“用户”,“o”:“1-232-242-1829”,“s”: "这是我的状态", "u": "user2"}, {"e": "[电子邮件受保护]", "f": "另一个", "i": "1702002", "h": "1-111-111 -1111”,“米”: "1-111-111-1111", "l": "用户", "o": "1-111-111-1111", "s": "另一个状态", "u": "user3"}]
现在,我的问题
1. 还有内置的 Google Sync 那么他们使用的是什么协议。 与上面相同或任何其他协议?
2. 我们可以创建自己的同步协议吗?如果是,那么在 android 中应该使用哪种类型的协议进行同步?
I am working on Sync in android.
I found an Example from sample in sdk, it works fine.
In example, While they are receiving data from server they are using below protocol.
[{"e": "[email protected]", "f": "Test", "i": "1709001", "h": "1-232-242-1829", "m": "1-232-242-1829", "l": "User", "o": "1-232-242-1829", "s": "This is my status", "u": "user2"}, {"e": "[email protected]", "f": "Another", "i": "1702002", "h": "1-111-111-1111", "m": "1-111-111-1111", "l": "User", "o": "1-111-111-1111", "s": "another status", "u": "user3"}]
Now, My Questions
1. There is also inbuilt Google Sync then what protocol they are using.
Same as above or any other protocol?
2. Can we create our own protocol for sync? if yes then which type of protocol should use for Sync in android?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Google 用于与自己的服务器同步的协议是私有的。
Android 上的同步根本不基于定义的协议。您编写一个同步适配器,它是一个软件组件,知道如何与远程服务交互以将数据与内容提供商同步。因此,您编写的同步适配器了解协议;平台本身对此一无所知。
例如,Android 上的 Exchange 被实现为身份验证器,负责将用户登录到 Exchange 帐户,然后为将同步的每种数据类型(联系人、日历等)提供一个同步适配器。
The protocol Google uses to sync with their own servers is private.
Sync on Android is not based on a defined protocol at all. You write a sync adapter, which is a software component that knows how to interact with a remote service to synchronize data with a content provider. So the sync adapter you write is what knows about the protocol; the platform itself knows nothing about it.
For example, Exchange on Android is implement as an Authenticator that takes care of logging the user in to an Exchange account, and then one sync adapter for each of the types of data it will sync (contacts, calendar, etc).