Gaket
Gaket

Reputation: 6829

Does ContactsContract query for the starred contacts return the "full" contact data?

If I query content from ContactsContract using CONTENT_STREQUENT_URI (to get starred and the most frequently contacted contacts):

Cursor callLogsCursor = context.getContentResolver()
        .query(Contacts.CONTENT_STREQUENT_URI, null, null, null, null);

will I get all the columns that I would get using usual ContactsContract.Contacts.CONTENT_URI?

 Cursor callLogsCursor = context.getContentResolver()
            .query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);

Docs say that:

CONTENT_STREQUENT_URI is The content:// style URI for this table joined with useful data from ContactsContract.Data, filtered to include only starred contacts and the most frequently contacted contacts.

But this "useful data" definition is quite vague, as for me...

Upvotes: 0

Views: 118

Answers (1)

marmor
marmor

Reputation: 28189

You'll get everything you'd normally get by querying Contacts.CONTENT_URI, plus, you can put in your projection fields from CommonDataKinds.Phone and CommonDataKinds.Email tables, and get those too.

Not sure about other CommonDataKinds tables, you can try adding to your projection whatever you need and check if it works or not, but make sure you test on a range of Android versions to make sure your projection is supported on all.

Upvotes: 1

Related Questions