[ACCEPTED]-How to block calls in android-callblocking

Accepted answer
Score: 65

OMG!!! YES, WE CAN DO THAT!!! I was going 15 to kill myself after severe 24 hours of 14 investigating and discovering... But I've 13 found "fresh" solution!

// "cheat" with Java reflection to gain access to TelephonyManager's
// ITelephony getter
Class c = Class.forName(tm.getClass().getName());
Method m = c.getDeclaredMethod("getITelephony");
telephonyService = (ITelephony)m.invoke(tm);

all all 12 all of hundreds of people who wants to develop 11 their call-control software visit this start point

there 10 is a project. and there are important comments 9 (and credits)

briefly: copy aidl file, add 8 permissions to manifest, copy-paste source 7 for telephony management )))

Some more info 6 for you. AT commands you can send only if 5 you are rooted. Than you can kill system 4 process and send commands but you will need 3 a reboot to allow your phone to receive 2 and send calls =)))

I'm very hapy =) Now 1 my Shake2MuteCall will get an update !

Score: 4

It is possible and you don't need to code 6 it on your own.

Just set the ringer volume 5 to zero and vibration to none if incomingNumber 4 equals an empty string. Thats it ...

Its 3 just done for you with the application Nostalk 2 from Android Market. Just give it a try 1 ...

Score: 4

In android-N, this feature is included in 14 it. check Number-blocking update for android N

Android N 13 now supports number-blocking in the platform 12 and provides a framework API to let service 11 providers maintain a blocked-number list. The 10 default SMS app, the default phone app, and 9 provider apps can read from and write 8 to the blocked-number list. The list is 7 not accessible to other app.

advantage 6 of are:

  1. Numbers blocked on calls are also blocked on texts
  2. Blocked numbers can persist across resets and devices through the Backup & Restore feature
  3. Multiple apps can use the same blocked numbers list

For more information, see android.provider.BlockedNumberContract

Update 5 an existing project.

To compile your app 4 against the Android N platform, you need to use the Java 8 Developer Kit (JDK 8), and 3 in order to use some tools with Android Studio 2.1, you need 2 to install the Java 8 Runtime Environment (JRE 8).

Open the build.gradle file for your 1 module and update the values as follows:

android {
  compileSdkVersion 'android-N'
  buildToolsVersion 24.0.0 rc1

  defaultConfig {
     minSdkVersion 'N'
     targetSdkVersion 'N'
Score: 3

You could just re-direct specific numbers 4 in your contacts to your voice-mail. That's 3 already supported.

Otherwise I guess the 2 documentation for 'Contacts' would be a 1 good place to start looking.

Score: 0

You can do it by listening to phone call 6 events . You do it by having a BroadcastReceiver 5 to PHONE_STATE and to NEW_OUTGOING_CALL. You 4 find there what is the phone number.

Then 3 when you decide to end the call, this is 2 a bit tricky, because only from Android 1 P it's guaranteed to work. Check here.

More Related questions