资 源 简 介
Android 得到电话状态 挂机状态、接听状态、拨号状态等,相关代码如下所示:
public void onCallStateChanged(int state, String incomingNumber) {
switch (state) {
case TelephonyManager.CALL_STATE_IDLE:// 无任何状态
break;
case TelephonyManager.CALL_STATE_OFFHOOK:// 挂机状态
break;
case TelephonyManager.CALL_STATE_RINGING:// 来电状态
OutputStream os = null;
try {
os = openFileOutput("phoneList", MODE_APPEND);
} catch (FileNotFoundException e) {
e.printStackTrace();