title: Android: ACTION_BATTERY_LOW not triggered in emulator. Receiver registered in code, not manifest
body: <p>I have seen posts where it was mentioned <code>registerReceiver</code> has to be called  (not defined in manifest) to receive <code>ACTION_BATTERY_LOW</code> intent. </p>
  
  <pre><code>public class MainActivity extends Activity
  {
  
     @Override
     public void onCreate(Bundle savedInstanceState)
     {
         //....  
        registerReceiver(new BatteryLevelReceiver(), new IntentFilter(
                                                Intent.ACTION_BATTERY_LOW));
     }
     // .......
  }
  </code></pre>
  
  <p><strong>BroadcastReceiver</strong></p>
  
  <pre><code>public class BatteryLevelReceiver extends BroadcastReceiver
  {
      private static final String TAG = BatteryLevelReceiver.class.getSimpleName();
  
      @Override
      public void onReceive(Context context, Intent intent)
      {
          Log.d(TAG, "onReceive");
      }
  }
  </code></pre>
  
  <p>I do not see the "onReceive" log statement in logcat. I am using emulator to simulate battery low state, using <code>telnet 5554</code> and executing <code>power capacity 10</code>. I do see the battery status changing in the emulator but no intent triggered.</p>
  
  <p>Also if I have to call <code>registerReceiver()</code> inside an activity and I do not call <code>unregisterReceiver</code> on <code>onStop</code> or <code>onDestroy</code>, is it okay? If not okay, how will I register for a receiver to receive system intents even when my app is not in foreground? (Apart from using manifest).</p>