title: Register Broadcastreceiver in manifest
body: <p>I have the following manifest.xml:</p>
  
  <p>
      </p>
  
  <pre><code>&lt;application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:supportsRtl="true"
      android:theme="@style/AppTheme"&gt;
  
      &lt;receiver android:name=".PhoneStateBroadcastReceiver"
          android:permission="android.permission.READ_PHONE_STATE"&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"&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;
  </code></pre>
  
  <p>The listener receives data while the main activity is running. However when the main activity is killed, the receiver stops to output information. </p>
  
  <p>The receiver is an example class:</p>
  
  <pre><code>public class PhoneStateBroadcastReceiver extends BroadcastReceiver {
  
      private static final String TAG = "PhoneReceiver";
      Context mContext;
      String incoming_number;
      private int prev_state;
  
      @Override
      public void onReceive(Context context, Intent intent) {
          TelephonyManager telephony = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE); //TelephonyManager object
          CustomPhoneStateListener customPhoneListener = new CustomPhoneStateListener();
          telephony.listen(customPhoneListener, PhoneStateListener.LISTEN_CALL_STATE); //Register our listener with TelephonyManager
  
          Bundle bundle = intent.getExtras();
          String phoneNr = bundle.getString("incoming_number");
          Log.v(TAG, phoneNr);
          Log.d( TAG, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" );
          mContext = context;
      }
  
      /* Custom PhoneStateListener */
      public class CustomPhoneStateListener extends PhoneStateListener {
  
          private static final String TAG = "CustomStateListener";
  
          @Override
          public void onCallStateChanged(int state, String incomingNumber){
  
              if( incomingNumber != null &amp;&amp; incomingNumber.length() &gt; 0 )
                  incoming_number = incomingNumber;
  
              switch(state){
                  case TelephonyManager.CALL_STATE_RINGING:
                      Log.d(TAG, "CALL_STATE_RINGING");
                      prev_state=state;
                      break;
  
                  case TelephonyManager.CALL_STATE_OFFHOOK:
                      Log.d(TAG, "CALL_STATE_OFFHOOK");
                      prev_state=state;
                      break;
  
                  case TelephonyManager.CALL_STATE_IDLE:
  
                      Log.d(TAG, "CALL_STATE_IDLE==&gt;"+incoming_number);
  
                      if((prev_state == TelephonyManager.CALL_STATE_OFFHOOK)){
                          prev_state=state;
                          //Answered Call which is ended
                      }
                      if((prev_state == TelephonyManager.CALL_STATE_RINGING)){
                          prev_state=state;
                          //Rejected or Missed call
                      }
                      break;
              }
          }
      }
  }
  </code></pre>
  
  <p>As far as I understood the android principles, when a receiver is registered in manifest then it should receive data even if its app is killed, if so, what am I doing wrong?</p>