0

i have a foreground service detecting a shake event in order to lock / unlock the screen... i can lock the screen but im not finding a way to wake screen up:

my service:

if (mAccel > 31) {
if (count=="1"){   count = "2";
ToneGenerator toneGen1 = new ToneGenerator(AudioManager.STREAM_MUSIC, 100);
toneGen1.startTone(ToneGenerator.TONE_CDMA_PIP,150);
deviceManger .lockNow() ;
} else if (
count=="2") {
count = "1";
ToneGenerator toneGen1 = new ToneGenerator(AudioManager.STREAM_MUSIC, 100);
toneGen1.startTone(ToneGenerator.TONE_CDMA_PIP,250);
};
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Bruno Alex
  • 63
  • 3
  • 13
  • 1
    I believe the referenced answer is quite obsolete. A lot has changed in the way of security on Android and those methods don't work any longer. You'll need to look at the PowerManager and Keyguard classes to wake up the phone and if there is a lock on the screen (PIN, Pattern, Password, Biometric, etc). – Alther Nov 19 '20 at 17:06
  • im learning adroid studio its very hard since all tuturials and things i find on the net don't work any longer :/ – Bruno Alex Nov 19 '20 at 17:28

0 Answers0