get Battery Status - Android android.os

Android examples for android.os:Battery

Description

get Battery Status

Demo Code

import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.BatteryManager;

public class Main{

    private static Intent getBatteryStatus(Context context) {
        IntentFilter filter = new IntentFilter(
                Intent.ACTION_BATTERY_CHANGED);
        return context.registerReceiver(null, filter);
    }//from   w w w  .  j  a v  a  2  s .co m

}

Related Tutorials