我正在应用以下代码来显示三种状态的消息,
1) 通话被拒 2) 通话已接 3) 通话结束
TelephonyManager telephonyManager;
PhoneStateListener listener = new PhoneStateListener() {
public void onCallStateChanged(int state,String incomingNumber) {
switch (state) {
case TelephonyManager.CALL_STATE_IDLE:
Toast.makeText(c, "Call Ended..",Toast.LENGTH_LONG).show();
Log.i("stop", "Call Ended....");
break;
case TelephonyManager.CALL_STATE_OFFHOOK:
Toast.makeText(c, "Call Picked..",Toast.LENGTH_LONG).show();
Log.i("received", "Call Picked....");
break;
case TelephonyManager.CALL_STATE_RINGING:
Toast.makeText(c, "Call Ringing.." + phonenumber,
Toast.LENGTH_LONG).show();
break;
}
}
};
// Register the listener with the telephony manager
telephonyManager.listen(listener,PhoneStateListener.LISTEN_CALL_STATE);
}
当我拒绝呼叫时,它也进入 hook_state,如何显示两个单独接收和呼叫拒绝/拒绝的消息
提前致谢..
请帮忙