将数据关联到 Android 联系人
我正在寻找一种将一些数据与手机的所有联系人相关联的方法,因此我一直在尝试处理 ContactsContract.RawContacts.Data 类,但我无法让某些东西起作用。
此外,我认为我可以使用 LookupKey 作为数据库中的主键 >_<看来我对这个密钥的用途是错误的,因为我所有的联系人都将其设置为 550。(错误的查询?)任何人都可以给我有关 LookupKey 用途的线索/进一步解释吗?
基本上,我的应用程序在服务器上查找联系人的姓名,如果在服务器上找到该姓名,我应该将联系人+数据存储在该特定数据库中。
如果我设法让 ContactsContract.RawContacts.Data 类执行我想要的操作,则可以避免数据库问题,对吧?
提前致谢。
I am looking for a way to associate some data to all the contacts of the phone, and thus I have been trying to deal with the ContactsContract.RawContacts.Data Class but I couldn't get something to work.
More over, I thought I could use the LookupKey as a Primary key in a DB >_< it seems I was wrong about the purpose of this key, as all my contacts have it set on 550. (wrong query ?) Could anyone give me a clue/further explanation about the purpose of the LookupKey ?
Basically, my app looks for the name of the contact on a server, and i should store the contact+data in that particular DB if the name was found on the server.
The DB thing could be avoided if I manage to get the ContactsContract.RawContacts.Data Class to do what i want, right ?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您的应用程序需要维护对联系人的引用时,将使用查找键。您必须使用查找键而不是常规联系人行 ID 的原因是,联系人可能会被聚合或手动加入,从而使您的 ID 引用无处可寻。
将您的应用程序联系人与 Android 同步应该相当简单。 这里你有一个last.fm 应用程序的工作示例以及关于 Android 开发人员的这个很棒的教程网络。
The lookup key is used when your app needs to maintain references to contacts. The reason you have to use a lookup key instead of the regular contact row id is that contacts can get aggregated or manually joined, making your id references point nowhere.
It should be fairly straightforward to sync your app contacts with android. Here you have a working example for the last.fm application and this great tutorial on the android developers' web.