如何在android中以编程方式结束传入/传出呼叫?

时间:2013-12-19 14:44:47

标签: android

我想知道如何在android中以编程方式结束传入/传出呼叫。 我尝试了here发布的解决方案,但我没有运气让它发挥作用。

我使用以下代码断开使用BroadCast的呼叫...

try{
       TelephonyManager manager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
       Class c = Class.forName(manager.getClass().getName());
       Method m = c.getDeclaredMethod("getITelephony");
       m.setAccessible(true);
       ITelephony telephony = (ITelephony)m.invoke(manager);
       telephony.endCall();
  } catch(Exception e){
       Log.d("",e.getMessage());
  }

但我收到了错误:

NO such method name 'getITelephony' in ICS call is not disconnecting

1 个答案:

答案 0 :(得分:1)

我认为这种方式在Android 2.3+中不再可用, this文章正在讨论此问题