Not getting battery status at the beginning of the application
<p>I'm trying to control battery levels and power connection on my application with some listeners, but for some reason they are not getting updated neither at the beginning of the application. Is there any way of doing it manually?</p>

<p>class PhoneStatusService</p>

<pre><code>private BroadcastReceiver mPowerConnectedReceiver;

private BroadcastReceiver mPowerDisconnectedReceiver;

private BroadcastReceiver mNormalPowerReceiver;

private BroadcastReceiver mLowPowerReceiver;

private static boolean sIsBatteryCharging = false;

private static boolean sIsBatteryLevelOk = true;
</code></pre>

<p>onCreate()</p>

<pre><code>    mPowerConnectedReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(final Context context, final Intent intent) {
            PhoneStatusService.this.setChargingStatus(true);
        }
    };
    mPowerDisconnectedReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(final Context context, final Intent intent) {
            PhoneStatusService.this.setChargingStatus(false);
        }
    };
    mNormalPowerReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(final Context context, final Intent intent) {
            PhoneStatusService.this.setBatteryLevel(true);
        }
    };
    mLowPowerReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(final Context context, final Intent intent) {
            PhoneStatusService.this.setBatteryLevel(false);
        }
    };
    this.registerReceiver(mPowerConnectedReceiver, new IntentFilter(
            Intent.ACTION_POWER_CONNECTED));
    this.registerReceiver(mPowerDisconnectedReceiver, new IntentFilter(
            Intent.ACTION_POWER_DISCONNECTED));
    this.registerReceiver(mNormalPowerReceiver, new IntentFilter(Intent.ACTION_BATTERY_OKAY));
    this.registerReceiver(mLowPowerReceiver, new IntentFilter(Intent.ACTION_BATTERY_LOW));
</code></pre>
