Android Open Source - Interception Block

From Project

Back to project page Interception.


The source code is released under:

# The Code Project Open License (CPOL) 1.02 ###Preamble This License governs Your use of the Work. This License is intended to allow developers to use the Source Code and Executable Files provided a...

If you think the Android project Interception listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.bitgriff.androidcalls;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import telephony.ITelephony;
//from   w w w  . j  av a 2s. com
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.widget.Toast;

public class Block extends BroadcastReceiver {
    Context context = null;
    private static final String TAG = "Phone call";
    private ITelephony telephonyService;

    public void onReceive(Context context, Intent intent) {

        Log.v(TAG, "Receving....");
        TelephonyManager telephony = (TelephonyManager)
        try {
           // Class c = Class.forName(telephony.getClass().getName());
            //Method m = c.getDeclaredMethod("getITelephony");
            //telephonyService = (ITelephony) m.invoke(telephony);

        } catch (Exception e) {

        Method: droptIt()
        Purpose: Drop incoming calls if method is called.
        Prameters: None.
        Return: nothing (void).

        Note: Currently not working...The internet has lied!
    public void dropIt() {

        Log.v(TAG, "Trying to drop....");

     //   TelephonyManager telephony = (TelephonyManager)
       //         context.getSystemService(Context.TELEPHONY_SERVICE);
        try {

            //Class c = Class.forName(telephony.getClass().getName());
           // Method m = c.getDeclaredMethod("getITelephony");
           // telephonyService = (ITelephony) m.invoke(telephony);
        } catch (Exception e) {
            Log.v(TAG, "Error, could not drop call");


Java Source Code List