I need to disable the lock screen and at the same time the black screen.. I need to do this in the onStart of my service.
with this disable the lock screen, this works well:
KeyguardManager keyguardManager = (KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE);
KeyguardLock lock = keyguardManager.newKeyguardLock(KEYGUARD_SERVICE);
lock.disableKeyguard();
how disable also the black screen? I tried this but do not work...
PowerManager pm2 = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wakel = pm2.newWakeLock(PowerManager.FULL_WAKE_LOCK, "AttvaSchermo");
wakel.acquire();
or in the activity..
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
thanks in advance!