I have created an application for call blocking which is working fine but it's stuck in one scenario:
Scenario: When the first call is ongoing(user talking with the first caller) in between second caller call to same user & that new caller is in my Blocklist when my call blocking logic runs both calls ended immediately.
In the above case, I want to end call of second caller only. How to achieve this?
Is there any way to identify & block the particular call?
Here is my call blocking logic:
TelephonyManager telephony = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
String s = telephony.getClass().getName();
Class c = Class.forName(telephony.getClass().getName());
Method m = c.getDeclaredMethod("getITelephony");
m.setAccessible(true);
ITelephony telephonyService = (ITelephony) m.invoke(telephony);
telephonyService.endCall();
Thanks in advance.
来源:https://stackoverflow.com/questions/53866038/how-to-block-a-call-when-first-call-is-ongoing