如何解决这个错误" com.android.internal.telephony不能被解析为一个类型"在机器人 [英] how to resolve this error "com.android.internal.telephony cannot be resolved to a type" in android

查看:516
本文介绍了如何解决这个错误" com.android.internal.telephony不能被解析为一个类型"在机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了制约不必要的电话简单的调用过滤器的应用程序。我用下面的code,限制呼叫,但我无法甲阶酚醛树脂这条线以下code的问题 com.android.internal.telephony.ITelephony telephonyService =(ITelephony)m.invoke(TM) ;。就显示错误信息com.android.internal.telephony不能被解析为一个类型的Andr​​oid如何解决这个错误

i am creating simple call filter application which restrict unwanted calls. i use following code to restrict call but i am unable to resole problem of this line in below code " com.android.internal.telephony.ITelephony telephonyService = (ITelephony) m.invoke(tm); " it show the error message com.android.internal.telephony cannot be resolved to a type in android how to resolve this error .

public class CallBlockReceiver extends BroadcastReceiver{

    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO Auto-generated method stub

    }

    private void getTeleService(Context context) {
        TelephonyManager tm = (TelephonyManager) context
                .getSystemService(Context.TELEPHONY_SERVICE);
        try {
            // Java reflection to gain access to TelephonyManager's
            // ITelephony getter
            Log.v("", "Get getTeleService...");
            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);
        } catch (Exception e) {
            e.printStackTrace();
            Log.e("",
                    "FATAL ERROR: could not connect to telephony subsystem");
            Log.e("", "Exception object: " + e);
        }
}

}

请帮我。

推荐答案

您已经添加 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>这里

you have added ITelephony.AIDL file in your project? and if you have added then your package name must be com/android/internal/telephony/ITelephony.AIDL: for more information Blocking Incoming call. download AIDL file from here

这篇关于如何解决这个错误&QUOT; com.android.internal.telephony不能被解析为一个类型&QUOT;在机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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