如何以编程方式断开呼出 [英] How to disconnect a outgoing call programatically

查看:143
本文介绍了如何以编程方式断开呼出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用下面的code以编程方式断开一个呼叫,但它不工作。

I've used the following code to disconnect a call programatically but It's not working.

private void callDisconnect(){ 
    try{ 
        TelephonyManager manager = (TelephonyManager)this.getSystemService(this.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()); 
    } 
}

任何人可以帮助我?我需要改变code或东西... ??

Can anybody help me with this?? Do I need to change the code or something...??

推荐答案

有关中断通话编程,你必须添加 ITelephony.AIDL 文件在您的项目。如果已经添加了它,那么你的包名称必须是 COM /安卓/内部/电话/ ITelephony.AIDL :了解更多信息,请参阅禁止来电。请从AIDL文件<一个href=\"http://grep$c$c.com/file/repository.grep$c$c.com/java/ext/com.google.android/android/2.1_r2/com/android/internal/telephony/ITelephony.java\"相对=nofollow>这里。

For disconnecting a call programmatically you must add ITelephony.AIDL file in your project. If you have added it, then your package name must be com/android/internal/telephony/ITelephony.AIDL: for more information see Blocking Incoming call. Download the AIDL file from here.

要断开呼叫使用结束(); ITelephony的

这篇关于如何以编程方式断开呼出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆