Android SyncAdapter 服务器端实现
我读过很多关于同步适配器的教程,例如 http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-1 以及 Android Developer 上的 SampleSyncAdapter 示例代码 网站。 但我不明白服务器端如何处理身份验证和同步查询。我可以使用 php 从 mySQL 服务器数据库中查询吗?
I have read a lot of tutorials on Sync Adapter such as the tutorial on http://www.c99.org/2010/01/23/writing-an-android-sync-provider-part-1 as well as the SampleSyncAdapter sample code on Android Developer website.
But I don't understand that how the server side handles the Authentication and synchronization queries. Is it possible for me to use php to query from a mySQL server database?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您缺少的部件不是同步适配器的一部分。它是
AbstractAccountAuthenticator
。它是实际处理用户密码并将其传递到服务器的类,并且需要以与相关服务器很好匹配的方式编写它。如何:
首先,这个过程是如何运作的?
所以这个令牌的使用是有限的——一段时间后,服务器将拒绝接受它。此时,SyncAdapter 尝试使用令牌并收到身份验证错误。那么然后呢?
为什么?
所以有几个优点。
过期:
令牌有点危险。任何有权访问该令牌的人都可以以您的身份登录。因此,这里有一个好的做法:
Web 界面注销。令牌并没有真正的“注销”概念。
The piece you're missing is not part of a Sync Adapter. It's the
AbstractAccountAuthenticator
. It's the class that actually deals with the user's password, and passing it to the server, and it will need to be written in a manner that's well paired with the server in question.How:
First off, how does the process work?
So this token is limited use -- After a while, the server will refuse to accept it. At that point, the SyncAdapter tries to use the token and gets an authentication error. So then what?
Why?
So there are several advantages.
Expiration:
Tokens are kind of dangerous. Anyone who gets access to the token can login as you. So, good practices here:
a web interface logs out. There isn't really a 'logout' concept for tokens.