我怎么知道..似乎没有解决方案?是吗?
public void onCallStateChanged(int state, String incomingNumber) {
switch(state) {
case TelephonyManager.CALL_STATE_IDLE:
Log.d("Tony","Outgoing Call finished");
// Call Finished -> stop counter and store it.
callStop=new Date().getTime();
context.stopService(new Intent(context,ListenerContainer.class));
break;
case TelephonyManager.CALL_STATE_OFFHOOK:
Log.d("Tony","Outgoing Call Starting");
// Call Started -> start counter.
// This is not precise, because it starts when calling,
// we can correct it later reading from call log
callStart=new Date().getTime();
break;
}
}
这里我们只有 2 个状态??任何其他解决方案?一旦我们开始通话,OFFHOOK 就开始了,它一直保持到通话结束.. 无法区分它何时响铃或被接听.. 我的项目需要知道何时接听电话..