Thursday, July 18, 2013

Blocking Incoming call in Android Phone

Step 1:

Create Broadcast receiver class for incoming call


import java.lang.reflect.Method;


import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent
import android.telephony.TelephonyManager;
import android.util.Log;

public class PhoneCallReceiver 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) {


Step 2:
Create IDL interface for getting core Telephony service 
package name must be

FileName : ITelephony.aidl

  interface ITelephony {

    boolean endCall();

    void answerRingingCall();

    void silenceRinger();

Step 3:
AndroidManifest.xml configuration

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
   package="" android:versionCode="1"
   <application icon="@drawable/icon" label="@string/app_name">
       <service class=".MyService" name=".MyService">
           <action android:value=""
                   android:name=".MyService" />

      <activity android:name=".SampleAction"
               <action name="android.intent.action.MAIN">
               <category name="android.intent.category.LAUNCHER">

   <uses-sdk minsdkversion="8">



It was a great information and Its really worth enough reading it. The author did an mind blowing work by describing each and every concept in detail. Thanks for such an informative post. Please keep up your good work.
Marine Colleges in Chennai, Engineering Colleges In Chennai

I absolutely admired every bit of it and i additionally accept you book apparent to analysis out fresh things in your site.
UI Design Companies in Bangalore, Web Application Development Companies in Bangalore

Good work…unique site and interesting too… keep it up…looking forward for more updates.Good luck to all of you and thanks so much for your hard-work.
Language Interpretation Services, Voiceover Bangalore

This comment has been removed by the author.

Thanks for sharing this great information, your blogs is so informative and knowledgable.
We are best Seo services company in delhi
Mobile app development company in Delhi

Post a Comment