Created
August 15, 2017 15:49
-
-
Save kamawanu/37735596987471bbaf1bd058a10f38a9 to your computer and use it in GitHub Desktop.
android adb tips
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/a/25864485 | |
adb shell content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:0 | |
adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:1 | |
adb shell content insert --uri content://settings/system --bind name:s:user_rotation --bind value:i:0 | |
# https://stackoverflow.com/a/41455424 | |
adb shell settings put system accelerometer_rotation 0 #disable auto-rotate | |
adb shell settings put system user_rotation 3 #270° clockwise |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to prevent an android device from entering sleep (via adb command shell) | |
# https://stackoverflow.com/a/39634573 | |
adb shell svc power stayon true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to start an application using android ADB tools? | |
# https://stackoverflow.com/a/4567928 | |
am start -n com.package.name/com.package.name.ActivityName | |
# https://stackoverflow.com/a/25398877 | |
adb shell monkey -p your.app.package.name -c android.intent.category.LAUNCHER 1 | |
# https://stackoverflow.com/a/17289998 | |
pkg=$(aapt dump badging $1|awk -F" " '/package/ {print $2}'|awk -F"'" '/name=/ {print $2}') | |
act=$(aapt dump badging $1|awk -F" " '/launchable-activity/ {print $2}'|awk -F"'" '/name=/ {print $2}') | |
adb shell am start -n $pkg/$act | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment