Given a phone number, how can I look up the _id of the DATA row for
that phone number?

I was assuming that the following query would do it:

Uri lookupUri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI,
Uri.encode(phoneNumber));
Cursor c = resolver.query(lookupUri, new String[] { PhoneLookup._ID },
null, null, null);
if (c.moveToFirst()) {
    long id = c.getLong(0);
    // do stuff with id
}

... but it is returning the contact_id, not the id of the phone
record.

The official api docs for PhoneLookup indicate that _ID returns the
"Data row ID":

http://developer.android.com/reference/android/provider/ContactsContract.PhoneLookup.html

... but that appears to be incorrect.  Am I missing something?  How
can I efficiently look up the data _id(s) for a given phone number?

Thanks in advance ...

-- 
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