Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I wake an android device up and skip the screenlock

As title, is it possible for me to wake my phone up and skip the screenlock? I want to write an app based on the alarm clock, when it's time, the app should do detect something in the background even when the phone is sleeping. When something is detected, the phone should automatically wake up, skip the screenlock, and show a picture(start a new activity ). Can anybody give me some suggestions or examples on these? Thanks a lot!

like image 978
Jim31837 Avatar asked Oct 10 '22 19:10

Jim31837


1 Answers

The activity you're starting needs one or both of the following layout parameters.

Use FLAG_SHOW_WHEN_LOCKED so that the activity appears above the screenlock.

Use FLAG_DISMISS_KEYGUARD to automatically dismiss the keyguard.

More details at http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html.

like image 193
Nik Avatar answered Oct 14 '22 02:10

Nik