问题拒绝来电 [英] Problem with rejecting incoming call

查看:105
本文介绍了问题拒绝来电的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图拒绝来电BU此code:

I try to reject incoming call bu this code:

    private void ignoreCallAidl(Context context) 
{
        try
        {
                tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
                Class c = Class.forName(tm.getClass().getName());
                Method m = c.getDeclaredMethod("getITelephony");
                m.setAccessible(true);
                telephonyService = (ITelephony)m.invoke(tm);
                telephonyService.silenceRinger();
                telephonyService.endCall();

        } 
        catch (Exception e) 
        {
                e.printStackTrace();
                Log.e("App","FATAL ERROR: could not connect to telephony subsystem");
                Log.e("App","Exception object: "+e);
        }
}

但我得到一个错误:
异常对象:java.lang.ClassCastException:com.android.internal.telephony.ITelephony $存根$代理

But i get an error: Exception object: java.lang.ClassCastException: com.android.internal.telephony.ITelephony$Stub$Proxy

推荐答案

我有同样的问题,但我已经解决了。

I had the same problem, but I have solved it.

这是因为您从 ITelephony.aidl proguarded的ITelephony。你必须在 proguard.cfg 文件进行过滤。

It's because you have proguarded the ITelephony from ITelephony.aidl. You have to filter it in the proguard.cfg file.

这篇关于问题拒绝来电的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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