How to pick contacts only from google contacts (not facebook etc) with phone numbers?
<p>I need to fix a bug in an old app of mine. Part of the bug is how I select contacts. Here is what I need:</p>

<ol>
<li>The contact must be from the
'normal' google contacts list, i.e.
I don't want to get any contacts
from facebook or similar.</li>
<li>The contact must have at least one phone number.</li>
<li>The contact must be from the old <code>android.provider.Contacts</code> provider.</li>
<li>If I can use an Intent to fetch the contact URI without having to create the selection list etc myself, then that is a bonus.</li>
</ol>

<p>Sounds simple, but I am really struggling. This is what I am trying:</p>

<pre><code>@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Intent intent = new Intent(Intent.ACTION_PICK, Contacts.People.CONTENT_URI);
    startActivityForResult(intent, PICK_CONTACT_REQUEST);
}
</code></pre>

<p>That works OK. I still see contacts without phone numbers, but I can live with that. Worse though is that I still see facebook contacts in the list! This seems to be in contradiction to the following quote found at the <a href="http://developer.android.com/reference/android/provider/Contacts.html">Froyo API for the deprecated Contacts content provider</a>:</p>

<blockquote>
  <p>The APIs have been superseded by ContactsContract. The newer APIs allow access multiple accounts and support aggregation of similar contacts. These APIs continue to work but will only return data for the first Google account created, which matches the original behavior. </p>
</blockquote>

<p>That sounds like exactly what I wanted, but alas, not what I got. </p>

<p>Finally, here are my concrete questions that I hope someone can answer:</p>

<ol>
<li>Why am I seeing Facebook contacts when using the android.provider.Contacts content provider?</li>
<li>If this doesn't work, how else can I get the user to select a google contact with a phone number?</li>
</ol>

<p>Many thanks.
Gustav</p>
