title: BroadcastReceiver for Incoming calls in android doesn't work
body: <p>I'm trying to develop android app for that can record phone calls. So, in the initial step, I've to see if BroadcastReceiver is getting fired or not.
  I've added permissions, receiver tag in AndroidManifest file. I'm testing on OnePlus X. Activity is gets started but BroadcastReceiver doesn't get fired when I get call. What's going wrong here?</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.example.myapp"&gt;
  &lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt;
  
  &lt;application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:supportsRtl="true"
      android:theme="@style/AppTheme"&gt;
  
      &lt;activity
          android:name="com.example.myapp.MainActivity"
          android:label="@string/app_name"
          android:screenOrientation="portrait"&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;receiver android:name=".PhoneStateReceiver"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.PHONE_STATE" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
  
  &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>PhoneStateReceiver.Java</p>
  
  <pre><code>package com.example.myapp;
  
  import android.content.BroadcastReceiver;
  import android.content.Context;
  import android.content.Intent;
  import android.telephony.TelephonyManager;
  import android.widget.Toast;
  
  public class PhoneStateReceiver extends BroadcastReceiver {
      @Override
      public void onReceive(Context context, Intent intent) {
  
          try {
              System.out.println("Receiver start");
              String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE);
              String incomingNumber = intent.getStringExtra(TelephonyManager.EXTRA_INCOMING_NUMBER);
  
              if(state.equals(TelephonyManager.EXTRA_STATE_RINGING)){
                  Toast.makeText(context,"Incoming Call State",Toast.LENGTH_SHORT).show();
                  Toast.makeText(context,"Ringing State Number is -"+incomingNumber,Toast.LENGTH_SHORT).show();
  
  
              }
              if ((state.equals(TelephonyManager.EXTRA_STATE_OFFHOOK))){
                  Toast.makeText(context,"Call Received State",Toast.LENGTH_SHORT).show();
              }
              if (state.equals(TelephonyManager.EXTRA_STATE_IDLE)){
                  Toast.makeText(context,"Call Idle State",Toast.LENGTH_SHORT).show();
              }
          }
          catch (Exception e){
              e.printStackTrace();
          }
  
      }
  }
  </code></pre>