2011-03-14 83 views

回答

2

再次編輯我的答案,因爲最後提到的鏈接不工作好。 首先,你需要讓你可以參考下面鏈接的幫助下管理來電號碼:
Retrieve incoming call's phone number in Android

所以一旦你有多少,你可以使用下面的代碼來獲取聯繫人姓名:

Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(phoneNumber)); 
resolver.query(uri, new String[]{PhoneLookup.DISPLAY_NAME} .....) 
+0

在此行中顯示錯誤getContentResolver – indira 2011-03-14 10:46:45

+0

在擴展Activity類的類中使用該代碼。 – 2011-03-14 10:55:53

+0

謝謝Rohit。當我添加READ_CONTACT權限時,該應用程序可以正常工作 – indira 2011-03-16 11:47:23

4

TelephonyManager.EXTRA_INCOMING_NUMBER

相關問題