Associate data to android contacts
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 Lo开发者_JAVA百科okupKey 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.
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.
精彩评论