views:

73

answers:

2

My application is launched on car docking event, i want to wake up phone (done by system) and unlock screen when i plug my device. Is it posssible ?

A: 

It is not. There are some mechanisms where you can do a limited amount of things while the screen remains locked, but to do more you have to call something that asks the user to unlock the screen via their password/gesture. (exit key guard securely or something like that)

Chris Stratton
+1  A: 

Use Activity.getWindow() to get the window of your activity; use Window.addFlags() to add whichever of the following flags in WindowManager.LayoutParams that you desire: FLAG_DISMISS_KEYGUARD, FLAG_SHOW_WHEN_LOCKED, FLAG_TURN_SCREEN_ON

This is how the standard car dock (and desk dock) app implements this behavior.

hackbod