service 와 receiver 를 통해 전화번호를 얻는 방법은 아래 링크를 참조하시면 될 거 같습니다.
http://stackoverflow.com/questions/15563921/how-to-detect-incoming-calls-in-an-android-device
전화번호를 얻어내셨으면 아래와 같은 메소드를 이용하여 연락처를 얻어내면 됩니다.
public static String getContactName(Context context, String phoneNumber) {
ContentResolver cr = context.getContentResolver();
Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(phoneNumber));
Cursor cursor = cr.query(uri, new String[]{PhoneLookup.DISPLAY_NAME}, null, null, null);
if (cursor == null) {
return null;
}
String contactName = null;
if(cursor.moveToFirst()) {
contactName = cursor.getString(cursor.getColumnIndex(PhoneLookup.DISPLAY_NAME));
}
if(cursor != null && !cursor.isClosed()) {
cursor.close();
}
return contactName;
}