8

I am using following adb shell command for unlocking the device screen.

adb shell input keyevent 82

This is working fine for My enterprise device which has Android L device. However, when I used this same command for device with Kit Kat OS, it is not working. The screen has a Lock icon and circle around it, and i have to swipe it up.

Please suggest if an alternate commands.

Humble_PrOgRaMeR
  • 689
  • 4
  • 14
  • 34
  • The keyevent 82 represents the KEYCODE_MENU (https://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_BACK) which will simply simulate the "Option menu" press on the device. Similar is the keyevent 4 (KEYCODE_BACK) – darthvading Aug 10 '17 at 15:37
  • So, what is the solution for the above question. – Humble_PrOgRaMeR Aug 11 '17 at 07:31

1 Answers1

4

You can maybe detect the SDK version and if it is kitkat and below, you can use the below code to swipe.

SDK=`adb -s $i shell getprop ro.build.version.sdk | tr -d '\r'
if (( "$SDK" <= 19 )) ; then
adb shell input swipe 200 500 200 0
fi

You can tweak the parameters against swipe to get the exact start (x,y) and end (x,y) according to the screen you are using.

Shredder
  • 150
  • 1
  • 1
  • 15