how to resolve this error "com.android.internal.telephony cannot be resolved to a type" in android
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
You can use reflection to call methods on the ITelephony object thus avoiding the need to specify the type and add the AIDL file. For instance, ending a call:
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
Class<?> c = Class.forName(tm.getClass().getName());
Method m = c.getDeclaredMethod("getITelephony");
m.setAccessible(true);
Object telephonyService = m.invoke(tm);
Class<?> telephonyServiceClass = Class.forName(telephonyService.getClass().getName());
Method endCallMethod = telephonyServiceClass.getDeclaredMethod("endCall");
endCallMethod.invoke(telephonyService);