代码如下:
@Override
public void onCallStateChanged(int state, String incomingNumber) { if(lastState == TelephonyManager.CALL_STATE_RINGING&&
state == TelephonyManager.CALL_STATE_IDLE){//当前状态为空闲,而上次为响铃,则判断为未接来电
Log.d("MainActivity","phone number:"+incomingNumber);
}
lastState = state;
super.onCallStateChanged(state,incomingNumber);
}Log打印如下:
12-14 10:38:21.607 9291-9291/com.smstest D/MainActivity﹕ phone number:求大神解释一下啊,不甚感激
@Override
public void onCallStateChanged(int state, String incomingNumber) { if(lastState == TelephonyManager.CALL_STATE_RINGING&&
state == TelephonyManager.CALL_STATE_IDLE){//当前状态为空闲,而上次为响铃,则判断为未接来电
Log.d("MainActivity","phone number:"+incomingNumber);
}
lastState = state;
super.onCallStateChanged(state,incomingNumber);
}Log打印如下:
12-14 10:38:21.607 9291-9291/com.smstest D/MainActivity﹕ phone number:求大神解释一下啊,不甚感激
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货