How to retrieve the contact name from incoming call number?
Asked
Active
Viewed 4,403 times
2 Answers
2
First you need to get the incoming caller number which you can manage with the help of below reference question:
Retrieve incoming call's phone number in Android
So once you have the number, you can use the below code to get the contact name:
Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(phoneNumber));
resolver.query(uri, new String[]{PhoneLookup.DISPLAY_NAME} .....)

Cœur
- 37,241
- 25
- 195
- 267

Rohit Mandiwal
- 10,258
- 5
- 70
- 83
-
Thanks Rohit. The application works smoothly when I add READ_CONTACT permission – indira Mar 16 '11 at 11:47
-
Unfortunately, the link has rotted and your answer is useless. If you can please [edit] to give an answer that doesn't link to an outside source (except as a reference), it will be deleted. – Mar 05 '12 at 18:39