如何在android中解决此错误“com.android.internal.telephony无法解析为类型”

前端之家收集整理的这篇文章主要介绍了如何在android中解决此错误“com.android.internal.telephony无法解析为类型”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在创建简单的呼叫过滤应用程序,限制不必要的呼我使用以下代码来限制调用,但我无法在下面的代码解决此行的问题“com. android.internal.telephony.ITelephony telephonyService =(ITelephony)m.invoke(tm);”它显示错误消息com. android.internal.telephony无法解析为android中的某个类型如何解决错误.
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);
        }
}

}

请帮我 .

解决方法@H_404_8@
你在项目中添加了ITelephony.AIDL文件?如果你已经添加,那么你的包名必须是com / android / internal / telephony / ITelephony.AIDL:
有关更多信息 Blocking Incoming call.从 here下载AIDL文件

原文链接:https://www.f2er.com/android/313870.html

猜你在找的Android相关文章