title: Get phone number in Call End Broadcast Receiver?
body: <p>I am developing an application which make series of calls one after the other. To detect that the call has been ended, I have created Broadcast Receiver which successfully triggered when call ends but I am unable to get the phone number inside it. Here is my code</p>
  
  <pre><code>public class EndCallReceiver extends BroadcastReceiver {
  
  Preferences pref;
  Context ctx;
  
  @Override
  public void onReceive(Context context, Intent intent) {
  
      ctx = context;
      pref = new Preferences(ctx);
  
      Bundle extras = intent.getExtras();
      if (extras != null) {
          String state = extras.getString(TelephonyManager.EXTRA_STATE);
          String incomingNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
  
  
          if (state.equals(TelephonyManager.EXTRA_STATE_IDLE)) {
              Toast.makeText( ctx, incomingNumber, Toast.LENGTH_LONG).show();
          }
  
  
        }
    }
  
  }
  </code></pre>
  
  <p>There is nothing displayed in Toast. incomingNumber is null. Can anyone tell me. How can I get phone number inside end call BroadcastReceiver.</p>