我想拨打确切号码只需3秒钟,然后通话结束并自动重拨另一个固定号码。这怎么可能?任何人请帮助我....我已经尝试使用手机状态监听器,但它不工作.case
{
case TelephonyManager.CALL_STATE_OFFHOOK:
Log.d("CallRecorder", "CALL_STATE_OFFHOOK starting recording");
if (!incomingNumber.equals("+919037117434")||!incomingNumber.equals("9037117434")) {
try {
TelephonyManager telephonyManager = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
Class clazz = Class.forName(telephonyManager.getClass()
.getName());
Method method = clazz.getDeclaredMethod("getITelephony");
method.setAccessible(true);
ITelephony telephonyService = (ITelephony) method
.invoke(telephonyManager);
telephonyService.endCall();
} catch (Exception e) {
Log.d("", e.getMessage());
}
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:" + "9037117434"));
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
//callIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
context.startActivity(callIntent);
}
答案 0 :(得分:0)
您用于重定向呼叫的方法无效,请查看链接How can I forward (redirect) a call programmatically on Android?