Skip to content Skip to sidebar Skip to footer

Android: Event Action_power_connected And Action_power_disconnected Not Sent To My Broadcastreceiver

Somehow my ACTION_POWER_CONNECTED and ACTION_POWER_DISCONNECTED was never triggered when I plug/unplug my nexus 6 from charger. Manifest.xml: Copy

isCharging is always false even when device is plugged in. This can be fixed by the following code:

if(intent.getAction() == Intent.ACTION_POWER_CONNECTED) {
        Toast.makeText(context, "isCharging: " + true, Toast.LENGTH_LONG).show();
    } elseif(intent.getAction() == Intent.ACTION_POWER_DISCONNECTED){
        Toast.makeText(context, "isCharging: " + false, Toast.LENGTH_LONG).show();
    }

Post a Comment for "Android: Event Action_power_connected And Action_power_disconnected Not Sent To My Broadcastreceiver"