How to detect when the Battery's low : Android?
<p>I want to close my app when the battery level of the device gets low.
I have added following codes in manifest.</p>

<pre><code> &lt;receiver android:name=".BatteryLevelReceiver" 
         &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.ACTION_BATTERY_LOW" /&gt;
            &lt;action android:name="android.intent.action.ACTION_BATTERY_OKAY" /&gt;
        &lt;/intent-filter&gt;
 &lt;/receiver&gt;
</code></pre>

<p>And following code in receiver</p>

<pre><code>public class BatteryLevelReceiver extends BroadcastReceiver 
{

    @Override
    public void onReceive(Context context, Intent intent) 
    {
        Toast.makeText(context, "BAttery's dying!!", Toast.LENGTH_LONG).show();
        Log.e("", "BATTERY LOW!!");
    }
}
</code></pre>

<p>I am running the app on emulater and changing the battery level using telnet.
It changes the battery level but not showing any toast or logs. </p>

<p>What am I missing?? 
Any help is appreciated! 
Thank you.</p>
