Android examples for android.os:PowerManager
get Power Manager
import android.app.ActivityManager; import android.app.Service; import android.content.Context; import android.os.PowerManager; public class Main{ public static PowerManager getPowerManager(Context context) { try {/*from w ww . j a v a2 s . c o m*/ return (PowerManager) context .getSystemService(Context.POWER_SERVICE); } catch (SecurityException e) { } catch (ClassCastException e) { } return null; } }