4

Possible Duplicate:
How to block calls in android

I am developing an app in Android 2.2 which gets the phone state and checks if the incoming number is in blacklist table than it has to block that particular number.for this i am using given code:

 TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
 Class c = Class.forName(tm.getClass().getName());
 Method m = c.getDeclaredMethod("getITelephony");
 m.setAccessible(true);

 com.android.internal.telephony.ITelephony telephonyService = (com.android.internal.telephony.ITelephony) m.invoke(tm);
 telephonyService.silenceRinger();
 telephonyService.endCall();

All is going well but sometime my phone rings for a second before disconnect that call.

Please help me out if there is any other way to do this or should i modify my code to silently disconnect the blacklist call.

Thanks in advance.

Community
  • 1
  • 1
Abhay
  • 41
  • 1
  • 1
  • 4

1 Answers1

3

I think you must refer this question. It can helps you to do whatever you want.

Community
  • 1
  • 1
Praveenkumar
  • 24,084
  • 23
  • 95
  • 173