ADB Key event 82 for unlocking the Android device screen is not working for KK device

烈酒焚心 提交于 2020-06-10 13:02:09

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/45609855/adb-key-event-82-for-unlocking-the-android-device-screen-is-not-working-for-kk-d

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!