简体   繁体   English

确定在Android上拨打的号码

[英]Determining what # is being dialed on Android

I know that with the telephony manager listen, you can listen for 3 different states. 我知道通过电话管理器收听,您可以收听3种不同的状态。 Iknow that CALL_STATE_OFFHOOK indicates that there is at least one call that is dialing, active, etc. My question is- with the telephony manager, is there a way to determine what number the phone is off hook with? 知道CALL_STATE_OFFHOOK表示至少有一个呼叫正在拨号,正在通话等。我的问题是-对于电话管理器,是否有办法确定电话的挂机号码? I thought getLine1Number() might return that phone number that is being dialed, but it is not what I expect. 我以为getLine1Number()可能会返回正在拨打的电话号码,但这不是我期望的。 I am working with 2 emulators, and added a log line so that I could see what that method is doing. 我正在使用2个仿真器,并添加了一条日志行,以便可以看到该方法在做什么。 When dialing another emulator, I expected getLine1Number() to return 5554, but it was 15555218135. Perhaps there is another method I should be using instead? 拨打另一个模拟器时,我希望getLine1Number()返回5554,但返回值为15555218135。也许我应该使用另一种方法代替? Do I need to be into the source code to get the information I want? 我是否需要进入源代码才能获取所需的信息?

Clearly, getLine1Number() is returning the phone's number. 显然,getLine1Number()返回电话号码。 I currently have a work around of having the user use the program to initiate a call. 目前,我正在设法让用户使用该程序来发起呼叫。 They enter the number to dial in a text box and that way I can capture the number. 他们输入号码以在文本框中拨号,这样我就可以捕获该号码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM