开发者

Receive Phone Number from Phone Call

开发者 https://www.devze.com 2023-02-16 03:26 出处:网络
I\'m looking to make a customized phone log and was wondering if there 开发者_开发问答was some kind of built-in Android library that lets your app receive phone calls and then get the phone number or

I'm looking to make a customized phone log and was wondering if there 开发者_开发问答was some kind of built-in Android library that lets your app receive phone calls and then get the phone number or data from the phone call. That way I can store it in my customized phone log.


You should use Android's Telephony Manager for this:

http://developer.android.com/reference/android/telephony/TelephonyManager.html

You need to hook your application up to the ACTION_PHONE_STATE_CHANGED intent. The intent comes with a few extras, and one of them is EXTRA_INCOMING_NUMBER -- which contains the phone # as a string.

This site has a pretty good example:

http://www.tutorialforandroid.com/2009/01/get-phone-state-when-someone-is-calling_22.html

0

精彩评论

暂无评论...
验证码 换一张
取 消