So I am trying to use new contacts API to query for contacts that has
phone number.

resolver.query(
        ContactsContract.Contacts.CONTENT_URI,
        new String[]{ContactsContract.Contacts._ID,
ContactsContract.Contacts.DISPLAY_NAME,
ContactsContract.Contacts.LOOKUP_KEY},
        ContactsContract.Contacts.HAS_PHONE_NUMBER +" = 1",
        null,
        ContactsContract.Contacts.DISPLAY_NAME+" ASC");

This works fine. However if I query for a phone number based on
phoneLookup key:

resolver.query(
        PhoneLookup.CONTENT_FILTER_URI,
        new String[]{PhoneLookup.NUMBER},               // projection
        PhoneLookup.LOOKUP_KEY+"=?",                    // selection
        new String[]{lookupKey},                        // selection args
        null);

I get java.lang.IllegalArgumentException: Unknown URL
content://com.android.contacts/phone_lookup

This seems to be related to this issue 
http://code.google.com/p/android/issues/detail?id=4446
I am not sure though if contact's phone number should be accessed this
way.

It is good if you change API to make it more featureful though having
a documentation with a working example for this use case would be
really helpful.

Best,
Lukasz


On Nov 18, 7:30 am, Bonifaz <bonifaz.kaufm...@gmail.com> wrote:
> How do we then get all contacts/phonenumbers from all accounts?
> If I use the new Contacts API and send an ACTION.PICK for phone
> numbers like
>
> Intent i = new Intent(Intent.ACTION_PICK,
> android.provider.ContactsContract.CommonDataKinds.Phone.CONTENT_URI);
>
> it doesn't give me for example Facebook account phone numbers.
>
> even
>
> Intent i = new Intent(Intent.ACTION_PICK,
> android.provider.ContactsContract.Contacts.CONTENT_URI);
>
> doesn't show a list of all available contacts from all accounts (again
> I tried with Facebook contacts and they didn't show up).
>
> Dianne, could you please tell us how we use the PICK intent to get a
> list of all available phone numbers from all accounts.
>
> This would be really helpful.
>
> On Nov 17, 3:31 pm, Dianne Hackborn <hack...@android.com> wrote:
>
> > On Fri, Nov 6, 2009 at 6:31 PM, Ravi <textlo...@gmail.com> wrote:
> > > Now 2.0 Breaks every thing.
>
> > Wow that's pretty over-the-top.  The original contacts API still works, as
> > long as you weren't using private parts of it, and only for the primary
> > Google account.  So it still gives you the same functionality (the new
> > feature of additional accounts is not accessible from it, but that is why a
> > new API was required) as before.  And as we've said repeatedly for
> > everything, if you use private APIs you will break in the future, so that
> > shouldn't be a surprise.
>
> > --
> > Dianne Hackborn
> > Android framework engineer
> > hack...@android.com
>
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support, and so won't reply to such e-mails.  All such
> > questions should be posted on public forums, where I and others can see and
> > answer them.
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to