Unlock The Screen Programmatically
I have a share button in the GCM notification. On click of the share button, I need to launch share intent. Everything works perfectly. Only problem that I'm facing is Lollipop loc
Solution 1:
Step 1: Add below code in your activity before setContentView(R.layout.example);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON|
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD|
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED|
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
Step 2: Lock your mobile, then you will see activity in which you have added this code. This will work even though your mobile is locked with pattern lock. This will work like a charm.
Post a Comment for "Unlock The Screen Programmatically"