如何知道我是否成功地连接到我的Andr​​oid的呼出号码? [英] How to know if i am successfully connected to my outgoing number in Android?

查看:166
本文介绍了如何知道我是否成功地连接到我的Andr​​oid的呼出号码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Need to know this so that i could send DTMF and that is going to be my second question!

推荐答案

您可以使用的 PhoneStateLisenter 听出来改变呼叫状态。

You can use the PhoneStateLisenter to listen out for changes in the call state.

所以,你听的<一个href="http://developer.android.com/intl/fr/reference/android/telephony/PhoneStateListener.html#LISTEN_CALL_STATE"相对=nofollow> LISTEN_CALL_STATE 变化。

随着<一href="http://developer.android.com/intl/fr/reference/android/telephony/PhoneStateListener.html#onCallStateChanged%28int,%20java.lang.String%29"相对=nofollow> onCallStateChanged 方法。

所以,当振铃状态变为摘机,你知道一个电话已经连接

So when the state changes from RINGING to OFFHOOK you know a phone call has been connected

同样的原则也适用于闲置OFFHOOK在您的情况,听取了从空闲状态的变化来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.

您还可以查看到ACTION_NEW_OUTGOING_CALL意图,机器人可以让你陷阱这个呼叫时拨,你可能能够得到的结果code回来,说明该呼叫是否连接不是。

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 of not.

有关DTMF音频看看ToneGenerator,这允许您创建DTMF音调和.startTone()应该让你玩的DTMF音呢。

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音频。

However you cant send DTMF tones through the uplink.

这篇关于如何知道我是否成功地连接到我的Andr​​oid的呼出号码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆