任何人都可以告诉我如何保持和不接听电话吗?
我正在尝试使用ITelephony.aidl
但无法接听电话。这是我试图保持通话的代码
TelephonyManager tm = (TelephonyManager) CallholdddActivity.this.getSystemService(Context.TELEPHONY_SERVICE);
try{
Class<?> c = Class.forName(tm.getClass().getName());
Method m = c.getDeclaredMethod("getITelephony");
m.setAccessible(true);
com.android.internal.telephony.ITelephony telephonyService = (ITelephony) m.invoke(tm);
telephonyService = (ITelephony) m.invoke(tm);
//telephonyService.silenceRinger();
// here what should i write , i dont know
//System.out.println(a);
}
catch (Exception e) {
// TODO: handle exception
}
}
答案 0 :(得分:0)
使用ITelephony.aidl获取保留选项是不可能的,因为没有这样的方法。 最好使用音频管理器的任何方法来查找呼叫是否处于活动状态。但缺点是音频管理器也可以被其他应用程序使用。因此,在了解模式!!时会遇到两难境地。