Querying contacts in android using Contacts, ContactsContract
-
21-12-2019 - |
Question
I'm trying to query contacts using ContentResolver
in android. There are multiple options to query like contacts
, ContactsContract
, CommonDataKinds
, etc. But unable to decide advantages over each other. Please help me out in differentiating with each other and which one to use when.
Thanks!!
Solution
They all have to do with android versions, like
android.provider.ContactsContract.Contacts.People.CONTENT_URI
- this only works for Android 2.0 (SDK level 5) and higher.
On older versions of Android, we need to stick with the original android.provider.Contacts.CONTENT_URI
.
And ContactsContract.CommonDataKinds
is Container for definitions of common data types stored in the ContactsContract.Data table. If you want to know more check this.