我想知道是否有办法让用户结束来电(丢弃)或自动结束,因为没有响应(未接来电)。换句话说:我想在出现未接来电时(当通话自动结束时)做一些动作。
答案 0 :(得分:1)
当出现未接来电时,做那样的事情。在我的代码中,当未接来电出现时我打开了活动。
switch (state) {
case TelephonyManager.CALL_STATE_IDLE:
Log.v("idle state", "CALL_STATE_IDLE");
// CALL_STATE_IDLE ( OpenMissedCallScreen )
if (ring == true && callReceived == false && CheckMissCall.isRunning== false) {
flag = true;
if (prefs.getBoolean("main_state", true))
{
Intent inter = new Intent(c, MissCall.class);
}
}
break;
case TelephonyManager.CALL_STATE_OFFHOOK:
// CALL_STATE_OFFHOOK ( OpenReceivedCallScreen )
callReceived = true;
break;
case TelephonyManager.CALL_STATE_RINGING:
ring = true;
// CALL_STATE_RINGING ( openIncomingCallScreen )
break;