简体   繁体   English

如何知道我是否成功连接到 Android 中的拨出号码?

[英]How to know if i am successfully connected to my outgoing number in Android?

需要知道这一点,以便我可以发送 DTMF,这将是我的第二个问题!

You can use the PhoneStateLisenter to listen out for changes in the call state.您可以使用PhoneStateLisenter来监听呼叫状态的变化。

So you listen for the LISTEN_CALL_STATE change.所以你听听LISTEN_CALL_STATE的变化。

With the onCallStateChanged method.使用onCallStateChanged方法。

So when the state changes from RINGING to OFFHOOK you know a phone call has been connected因此,当状态从 RINGING 变为 OFFHOOK 时,您就知道电话已接通

Same principle applies for IDLE to OFFHOOK in your situation, listen out to the change from IDLE to OFFHOOK and you'll know your connected to a call.在您的情况下,IDLE 到 OFFHOOK 也适用相同的原则,听从 IDLE 到 OFFHOOK 的变化,您就会知道您已接通电话。

You can also look into the ACTION_NEW_OUTGOING_CALL intent, Android allows you to "trap" this when a call is dialled and you may be able to get a result code back stating whether the call was connected or not.您还可以查看 ACTION_NEW_OUTGOING_CALL 意图,Android 允许您在拨打电话时“捕获”它,并且您可能能够返回结果代码,说明呼叫是否已连接。

For DTMF tones look into ToneGenerator, this allows you to create DTMF tones and .startTone() should allow you to play the DTMF tone then.对于 DTMF 音,请查看 ToneGenerator,这允许您创建 DTMF 音,然后 .startTone() 应该允许您播放 DTMF 音。

However you cant send DTMF tones through the uplink.但是,您不能通过上行链路发送 DTMF 音。

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

相关问题 我怎么知道我是否已成功连接到我打开连接的URL? - How do I know if I have successfully connected to the URL I opened a connection with? 我怎么知道我的Android APK的安装次数? - How can I know the number of Installs of my android APK? 我怎么知道我的消息是用spring amqp成功发送的? - How do I know that my message was sent successfully with spring amqp? 如何知道我的 android 设备是否已连接到 VoWIFI(Wifi 语音) - How to know if my android device is connected to VoWIFI (Voice over Wifi) 如何知道我是否在 Android 上通话? - How to know whether I am in a call on Android? 如何在 Android 上检测 TelephonyManager 拨出呼叫连接 State - How to detect TelephonyManager outgoing call connected State on Android Android:Java:Proguard:如何:验证我的jar(不同jar项目)/ apk是否成功处理? (我正在考虑对其进行逆向工程) - Android: Java: Proguard: How to: verify if my jar (different jar project)/apk are successfully processed? (I am thinking to reverse engineer it) 如何在Android Q中检测拨出电话号码 - How to detect outgoing call number in Android Q 如何在Android中检测到特定号码的去电? - How to detect outgoing call in android to a specific number? 我如何测试有人已连接到我的服务器? - How I am testing that someone is connected to my server?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM