wake Phone Up And Unlock - Android Phone

Android examples for Phone:Phone Information

Description

wake Phone Up And Unlock

Demo Code


//package com.java2s;

import android.app.*;
import android.content.*;

import android.os.*;

public class Main {

    public static void wakeUpAndUnlock(Context context) {
        KeyguardManager km = (KeyguardManager) context
                .getSystemService(Context.KEYGUARD_SERVICE);
        KeyguardManager.KeyguardLock kl = km.newKeyguardLock("unLock");

        kl.disableKeyguard();/*from  w w  w .  jav  a2 s.  c  o m*/

        PowerManager pm = (PowerManager) context
                .getSystemService(Context.POWER_SERVICE);
        PowerManager.WakeLock wl = pm.newWakeLock(
                PowerManager.ACQUIRE_CAUSES_WAKEUP
                        | PowerManager.SCREEN_DIM_WAKE_LOCK, "bright");
  
        wl.acquire();

        wl.release();
    }
}

Related Tutorials