//是否有接听
private boolean hasRemoteAnswer = false;
-
//通话结束
public static final int STATE_END = 9;
//正在挂断
//先监听电话的状态,这个在类创建的时候就已经监听的了
if (phoneNumList.size() > currentCallIndex) {
String targetPhoneNum = phoneNumList.get(currentCallIndex);
- callPhone(targetPhoneNum);
//开始准备超时
if (callDuration != 0) {
//需要按时挂断
handler.removeCallbacks(endCallTask);
+ ICLogger.d("set up end call task...");
handler.postDelayed(endCallTask, callDuration * 1000);
}
+ callPhone(targetPhoneNum);
}
if (currentCallIndex == phoneNumList.size() - 1) {
//拨号当前组最后一个号码了
.getMethod("getService", String.class);
IBinder binder = (IBinder) method.invoke(null, new Object[]{Context.TELEPHONY_SERVICE});
ITelephony telephony = ITelephony.Stub.asInterface(binder);
+ ICLogger.d("endCall...");
if (telephony != null) {
telephony.endCall();
}
} catch (Exception e) {
e.printStackTrace();
+ ICLogger.e("error", e);
}
}