title: issue with TelephonyManager, classNotFoundException
body: <p>I am trying to create an app that can block an incoming call. I am getting <code>ClassNotFoundException</code> for <code>TelephonyManager</code>.Following is the code I am using. What is that I am doing wrong here?</p>
  
  <p>BroadcastReceiver</p>
  
  <pre><code>import java.lang.reflect.Method;
  import com.android.internal.telephony.ITelephony;
  import android.content.BroadcastReceiver;
  import android.content.Context;
  import android.content.Intent;
  import android.os.Bundle;
  import android.telephony.TelephonyManager;
  import android.util.Log;
  
  public class TelephoneBroadcastReceiver extends BroadcastReceiver {
      String TAG = "My Tag";
      String incomingNumber = "";
      String incno1 = "5556";
      @Override
      public void onReceive(Context context, Intent intent) {
          // TODO Auto-generated method stub
  
          Log.d(TAG, "INF: Broadcast received.");
  
          try{
  
              TelephonyManager tManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
              Log.v(TAG, "Get getTeleService...");    
              Class c = Class.forName(tManager.getClass().getSimpleName());
              Method m = c.getDeclaredMethod("getITelephony");
              m.setAccessible(true);
              com.android.internal.telephony.ITelephony telephonyService = (ITelephony) m.invoke(tManager);
              Bundle bundle = intent.getExtras();
  
              incomingNumber = bundle.getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
              Log.v(TAG,incomingNumber );
              Log.v(TAG,incno1 );
              if ( incomingNumber.equals(incno1) ) {
                   telephonyService = (ITelephony) m.invoke(tManager);
                   telephonyService.silenceRinger();
                   telephonyService.endCall();
                   Log.v(TAG,"BYE BYE BYE" );
              }
              else{
                  telephonyService.answerRingingCall();
                  Log.v(TAG,"HELLO HELLO HELLO" );
              }           
          }catch(Exception e){
              e.printStackTrace();
              Log.e(TAG,
                      "FATAL ERROR: could not connect to telephony subsystem");
              Log.e(TAG, "Exception object: " + e);
          }
      }
  }
  </code></pre>
  
  <p>Manifest File</p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.atiffarrukh.callandsmsfilter"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="8"
          android:targetSdkVersion="15" /&gt;
      &lt;uses-permission android:name="android.permission.READ_CONTACTS"/&gt;
      &lt;uses-permission android:name="android.permission.MODIFY_PHONE_STATE"/&gt;
      &lt;uses-permission android:name="android.permission.READ_PHONE_STATE"/&gt;
  
      &lt;application
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
  
          &lt;receiver android:name="com.atiffarrukh.callandsmsfilter.broadcastreceiver.TelephoneBroadcastReceiver" &gt;
              &lt;intent-filter  &gt;
                  &lt;action android:name="android.intent.action.PHONE_STATE" /&gt;
              &lt;/intent-filter&gt;
          &lt;/receiver&gt;
  
          &lt;activity
              android:name=".MainActivity"
              android:label="@string/title_activity_main" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>Now the Error</p>
  
  <pre><code>08-02 13:21:20.641: D/My Tag(557): INF: Broadcast received.
  08-02 13:21:20.641: V/My Tag(557): Get getTeleService...
  08-02 13:21:20.641: W/System.err(557): java.lang.ClassNotFoundException: TelephonyManager
  08-02 13:21:20.641: W/System.err(557):  at java.lang.Class.classForName(Native Method)
  08-02 13:21:20.641: W/System.err(557):  at java.lang.Class.forName(Class.java:235)
  08-02 13:21:20.641: W/System.err(557):  at java.lang.Class.forName(Class.java:182)
  08-02 13:21:20.641: W/System.err(557):  at com.atiffarrukh.callandsmsfilter.broadcastreceiver.TelephoneBroadcastReceiver.onReceive(TelephoneBroadcastReceiver.java:30)
  08-02 13:21:20.641: W/System.err(557):  at android.app.ActivityThread.handleReceiver(ActivityThread.java:2810)
  08-02 13:21:20.641: W/System.err(557):  at android.app.ActivityThread.access$3200(ActivityThread.java:125)
  08-02 13:21:20.641: W/System.err(557):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2083)
  08-02 13:21:20.641: W/System.err(557):  at android.os.Handler.dispatchMessage(Handler.java:99)
  08-02 13:21:20.641: W/System.err(557):  at android.os.Looper.loop(Looper.java:123)
  08-02 13:21:20.764: W/System.err(557):  at android.app.ActivityThread.main(ActivityThread.java:4627)
  08-02 13:21:20.764: W/System.err(557):  at java.lang.reflect.Method.invokeNative(Native Method)
  08-02 13:21:20.764: W/System.err(557):  at java.lang.reflect.Method.invoke(Method.java:521)
  08-02 13:21:20.764: W/System.err(557):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  08-02 13:21:20.764: W/System.err(557):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  08-02 13:21:20.764: W/System.err(557):  at dalvik.system.NativeStart.main(Native Method)
  08-02 13:21:20.764: W/System.err(557): Caused by: java.lang.NoClassDefFoundError: TelephonyManager
  08-02 13:21:20.764: W/System.err(557):  ... 15 more
  08-02 13:21:20.764: W/System.err(557): Caused by: java.lang.ClassNotFoundException: TelephonyManager in loader dalvik.system.PathClassLoader[/data/app/com.atiffarrukh.callandsmsfilter-1.apk]
  08-02 13:21:20.764: W/System.err(557):  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
  08-02 13:21:20.764: W/System.err(557):  at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
  08-02 13:21:20.764: W/System.err(557):  at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
  08-02 13:21:20.764: W/System.err(557):  ... 15 more
  08-02 13:21:20.764: E/My Tag(557): FATAL ERROR: could not connect to telephony subsystem
  08-02 13:21:20.764: E/My Tag(557): Exception object: java.lang.ClassNotFoundException: TelephonyManager
  </code></pre>
  
  <p><strong>Thanks...</strong></p>