Wake ups the phone via PowerManager - Android Android OS

Android examples for Android OS:Power

Description

Wake ups the phone via PowerManager

Demo Code


//package com.java2s;

import android.content.Context;

import android.os.PowerManager;

public class Main {
    /**//from  ww w  .j av a2  s . co  m
     * Wake ups the phone.
     * @param context
     */
    public static void partialWakeUpLock(Context context) {
        PowerManager pm = (PowerManager) context.getApplicationContext()
                .getSystemService(Context.POWER_SERVICE);
        PowerManager.WakeLock wakeLock = pm
                .newWakeLock(
                        (PowerManager.SCREEN_BRIGHT_WAKE_LOCK
                                | PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP),
                        "TAG");
        wakeLock.acquire();
    }
}

Related Tutorials