可能重复:
How can my android app detect a dropped call?
Detecting outgoing call and call hangup event in android
我制作的应用需要在通话结束时启动意图,但我不知道该怎么做, 我在Call Reciver中使用它来跟踪新的呼叫:
telephony.listen(imPhoneListener, PhoneStateListener.LISTEN_CALL_STATE);
答案 0 :(得分:1)
当无线电状态回到空闲状态时。但是你无法检测连接是否已建立。
答案 1 :(得分:1)
使用 TelephonyManager
public void onCallStateChanged(int state, String incomingNumber) {
String stateString = "N/A";
switch (state) {
case TelephonyManager.CALL_STATE_IDLE:
stateString = "Idle";
break;
case TelephonyManager.CALL_STATE_OFFHOOK:
stateString = "Off Hook";
break;
case TelephonyManager.CALL_STATE_RINGING:
stateString = "Ringing";
break;
}
System.out.println("state-:: " + stateString);
}