PowerManager pm= (PowerManager) Getsystemservice (Context.power_service);
Get the Power Manager object
Powermanager.wakelock wl = Pm.newwakelock (Powermanager.acquire_causes_wakeup | Powermanager.screen_dim_wake_lock, "bright");
Gets the Powermanager.wakelock object, followed by the parameter | Indicates the simultaneous passing of two values, and the last is the tag wl.acquire () used in Logcat;
Light screen Keyguardmanager km= (Keyguardmanager) Getsystemservice (Context.keyguard_service);
Get the keyboard lock Manager Object Keyguardlock KL = Km.newkeyguardlock ("UnLock");
The parameter is the tag Kl.disablekeyguard () used in Logcat;
Unlock
/*
* Other code to write the program here
*
* */
Kl.reenablekeyguard ();
Re-enable auto lock
Wl.release ();
Release
You need to add permissions in Androidmanifest.xml:
<uses-permission android:name= "Android.permission.WAKE_LOCK"/>
<uses-permission android:name= "Android.permission.DISABLE_KEYGUARD"/>
Android unlock screen lock with light on (incoming call effect)