我怎麼知道..似乎沒有解決方案?你好嗎?如何知道何時撥出電話?
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開始,它一直保持到通話結束..沒有辦法區分當它的響鈴或採摘..我的項目需要知道什麼時候接到電話..
其他建議? – navjosh