I'm writing an application that block some phone calls. I use a broadcast receiver to listen to incoming calls:
<receiver android:name="InComingCallReceiver">
<intent-filter android:priority="100">
<action android:name="android.intent.action.PHONE_STATE"></action>
</intent-filter>
</receiver>
And I cancelled the calls I don't want:
TelephonyManager telephony = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
try {
Class c = Class.forName(telephony.getClass().getName());
Method m = c.getDeclaredMethod("getITelephony");
m.setAccessible(true);
telephonyService = (ITelephony) m.invoke(telephony);
telephonyService.silenceRinger();
telephonyService.endCall();
}
catch (Exception e) {
Log.e(LOG_TAG,"Exception in InComingCallReceiver.onReceive");
Log.e(LOG_TAG,"ERROR: " + e.toString() + " Message: " + e.getMessage() + " --- " + e.getLocalizedMessage() + " Cause: " + e.getCause() + " StackTrace: " + e.getStackTrace());
}
The call is indead cancelled but it appears in the call log.
Is there a way to prevent call being log in the call log after I cancelled it?
If not, how can I delete from the log programatically?