开发者

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

开发者 https://www.devze.com 2022-12-26 14:48 出处:网络
Need to know this so that i could send DTMF and that is going t开发者_StackOverflowo be my second question!You can use the PhoneStateLisenter to listen out for changes in the call state.

Need to know this so that i could send DTMF and that is going t开发者_StackOverflowo be my second question!


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

So you listen for the LISTEN_CALL_STATE change.

With the onCallStateChanged method.

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

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.

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.

For DTMF tones look into ToneGenerator, this allows you to create DTMF tones and .startTone() should allow you to play the DTMF tone then.

However you cant send DTMF tones through the uplink.

0

精彩评论

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