本文介绍了如何检测传出铃声的结束?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想让我的程序的调用,之后识别呼叫状态。欲检测呼出的铃声的端
如何检测传出铃声的结束?
我用流动code代表发出呼叫的。
的EditText ED =(EditText上)findViewById(R.id.txtcall);
URI URI = Uri.fromParts(电话,ed.getText()的toString(),NULL);
callIntent =新意图(Intent.ACTION_CALL,URI);
startActivity(callIntent);
解决方案
继code片段可以帮助您找到的电话当前是否像其采摘,振铃或闲置。您可以轻松地利用这些国家和实施相应的功能。
私有类CustomPhoneStateListener扩展PhoneStateListener
{
@覆盖
公共无效onCallStateChanged(INT状态,弦乐incomingNumber)
{
super.onCallStateChanged(州,incomingNumber); //TelephonyManager.CALL_STATE_IDLE
//TelephonyManager.CALL_STATE_OFFHOOK
//TelephonyManager.CALL_STATE_RINGING
}
}
I want to make a call with my program and after that recognize the call status . I want to detect the end of outgoing ringtone.
How to detect the end of outgoing ringtone ?
I use of Flowing code for make call .
EditText ed=(EditText) findViewById(R.id.txtcall);
Uri uri=Uri.fromParts("tel", ed.getText().toString(), null);
callIntent = new Intent(Intent.ACTION_CALL,uri);
startActivity(callIntent);
解决方案
Following code snippet can help you in finding the phone call current statue whether its picked, ringing or idle. You can easily use these states and implement your functionality accordingly.
private class CustomPhoneStateListener extends PhoneStateListener
{
@Override
public void onCallStateChanged(int state, String incomingNumber)
{
super.onCallStateChanged(state, incomingNumber);
//TelephonyManager.CALL_STATE_IDLE
//TelephonyManager.CALL_STATE_OFFHOOK
//TelephonyManager.CALL_STATE_RINGING
}
}
这篇关于如何检测传出铃声的结束?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!