get Power Manager - Android android.os

Android examples for android.os:PowerManager

Description

get Power Manager

Demo Code

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;

    }

}

Related Tutorials