G gorelshv Member Licensed User Longtime User Aug 6, 2011 #1 Hi. I need a way to bypass the lockscreen and show the app. I've tried using WindowManager and setting a flag - "SHOW_WHEN_LOCKED" in a custom library but obviously I'm doing something wrong. here is the code I've tried to use: Code: Copy public void Unlock (final BA ba){ Window layoutparams = ba.activity.getWindow(); layoutparams.setFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED, WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); } When I run it I get a null reference exception... What am I doing wrong? Thanks in advance.
Hi. I need a way to bypass the lockscreen and show the app. I've tried using WindowManager and setting a flag - "SHOW_WHEN_LOCKED" in a custom library but obviously I'm doing something wrong. here is the code I've tried to use: Code: Copy public void Unlock (final BA ba){ Window layoutparams = ba.activity.getWindow(); layoutparams.setFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED, WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); } When I run it I get a null reference exception... What am I doing wrong? Thanks in advance.
Erel B4X founder Staff member Licensed User Longtime User Aug 7, 2011 #2 Have you declared your class with @ActivityObject? Otherwise ba.activity will be null.
G gorelshv Member Licensed User Longtime User Aug 7, 2011 #3 Erel said: Have you declared your class with @ActivityObject? Otherwise ba.activity will be null. Click to expand... Thank you! It worked! But now I have another problem. As I wake up the device and show my activity, I also want to run Voice Recognition. Problem is, as soon as VR shows the activity disappears and so is the little VR window, and the lock screen shows again. Without VR, my activity stays infront, as it should be. Any suggestions?
Erel said: Have you declared your class with @ActivityObject? Otherwise ba.activity will be null. Click to expand... Thank you! It worked! But now I have another problem. As I wake up the device and show my activity, I also want to run Voice Recognition. Problem is, as soon as VR shows the activity disappears and so is the little VR window, and the lock screen shows again. Without VR, my activity stays infront, as it should be. Any suggestions?
Erel B4X founder Staff member Licensed User Longtime User Aug 8, 2011 #4 Sorry but I never tried to programmatically unlock the screen.
G gorelshv Member Licensed User Longtime User Aug 8, 2011 #5 That's OK, thanks for helping. I've subscribed to this thread just in case someone comes up with a solution.
That's OK, thanks for helping. I've subscribed to this thread just in case someone comes up with a solution.