Getting a list of all phone contacts?

Posted by pcm2a on Stack Overflow See other posts from Stack Overflow or by pcm2a
Published on 2010-05-25T03:42:34Z Indexed on 2010/05/25 3:51 UTC
Read the original article Hit count: 202

Filed under:

Simple enough question. I need to know the best way to get the same list of contacts that show up when a user presses the Contacts button.

You would think something like this would work:

//For Contacts
Intent pickIntent = new Intent(Intent.ACTION_PICK, People.CONTENT_URI);
this.startActivityForResult(pickIntent, RESULT);

//For Phones
Intent pickIntent = new Intent(Intent.ACTION_PICK, Phones.CONTENT_URI);
this.startActivityForResult(pickIntent, RESULT);

The problem is that does not include secondary google accounts or Exchange contacts. By secondary accounts, in Android you can add additional gmail accounts to have the mail/contacts synced. The above intent will not list those additional contacts.

I am also told that on the HTC Desire you can add contacts to the phone that do not get synced up to Google. These contacts also do not show up.

So how do I get a real list of contacts so I can create my own list activity that works properly where the Google intent does not.

© Stack Overflow or respective owner

Related posts about android