我正在创建简单的呼叫过滤应用程序,限制不必要的呼我使用以下代码来限制调用,但我无法在下面的代码中解决此行的问题“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); } } }
请帮我 .