Reputation: 537
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);
}
}
But i get an error: Exception object: java.lang.ClassCastException: com.android.internal.telephony.ITelephony$Stub$Proxy
Upvotes: 2
Views: 6008
Reputation: 11
Follow these steps
It will work.
Upvotes: 1
Reputation: 41
I had the same problem, but I have solved it.
It's because you have proguarded the ITelephony from ITelephony.aidl
. You have to filter it in the proguard.cfg
file.
Upvotes: 4