I am trying to query contact information based on a phone number on android 1.6. This is the code I tried. But I get count equals to 0 in my cursor.
String selection = "PHONE_NUMBERS_EQUAL(" + People.Phones.NUMBER + " , " + phoneNumber + ")";
Cursor cursor = mContext.getContentResolver().query(People.CONTENT_URI,
new String[] {People._ID, People.NAME, People.Phones.NUMBER},
selection, null, null);
Do you have any idea why it is not working?
Thank you.
You can specify a URI to and use a query to directly get a contact info by phone number..
The cursor returned by the code above should then contain the contact you are looking for and you can get the info out you need…