Last active
June 23, 2024 06:47
-
-
Save zty5678/eb4627d7acbee76311097763ef4b99d6 to your computer and use it in GitHub Desktop.
android mobile demo mode. From https://awenger.de/android/2020/05/26/clean-android-screenshot-and-screen-recording.html
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
adb shell am broadcast -a com.android.systemui.demo -e command exit |
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
adb shell settings put global sysui_demo_allowed 1 | |
adb shell am broadcast -a com.android.systemui.demo -e command enter | |
adb shell am broadcast -a com.android.systemui.demo -e command clock -e hhmm 1000 | |
adb shell am broadcast -a com.android.systemui.demo -e command battery -e plugged false | |
adb shell am broadcast -a com.android.systemui.demo -e command battery -e level 100 | |
adb shell am broadcast -a com.android.systemui.demo -e command network -e wifi show | |
adb shell am broadcast -a com.android.systemui.demo -e command network -e wifi show -e level 4 | |
adb shell am broadcast -a com.android.systemui.demo -e command notifications -e visible false |
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
#TARGET_DIR="$HOME/Pictures/adb-screenshots/" | |
TARGET_DIR = "./" #current folder | |
FILE_NAME="$(date +"%Y-%m-%d-%H_%M_%S").mp4" | |
SCRIPTS_DIR=$(dirname $0) | |
function fetch_video() | |
{ | |
echo "retrieving file" | |
sleep 1 | |
mkdir -p $TARGET_DIR | |
adb pull /sdcard/$FILE_NAME $TARGET_DIR$FILE_NAME | |
adb shell rm /sdcard/$FILE_NAME | |
$SCRIPTS_DIR/adb_presentation_end.sh | |
echo "" | |
echo "File: $TARGET_DIR$FILE_NAME" | |
xdg-open $TARGET_DIR$FILE_NAME & disown | |
} | |
echo "waiting for device..." | |
adb wait-for-device | |
$SCRIPTS_DIR/adb_presentation_start.sh | |
echo "ctrl+c to stop recording" | |
trap fetch_video SIGINT | |
adb shell screenrecord /sdcard/$FILE_NAME |
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
#TARGET_DIR="$HOME/Pictures/adb-screenshots/" | |
TARGET_DIR = "./" #current folder | |
FILE_NAME="$(date +"%Y-%m-%d-%H_%M_%S").png" | |
SCRIPTS_DIR=$(dirname $0) | |
echo "waiting for device..." | |
adb wait-for-device | |
$SCRIPTS_DIR/adb_presentation_start.sh | |
mkdir -p $TARGET_DIR | |
adb exec-out screencap -p > $TARGET_DIR$FILE_NAME | |
$SCRIPTS_DIR/adb_presentation_end.sh | |
echo "" | |
echo "File: $TARGET_DIR$FILE_NAME" | |
xdg-open $TARGET_DIR$FILE_NAME & disown |
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
:: for windows | |
SET "TARGET_DIR=%~dp0" | |
SET "FILE_NAME=%date:~0,4%-%date:~5,2%-%date:~8,2%-%time:~0,2%_%time:~3,2%_%time:~6,2%.png" | |
SET "SCRIPTS_DIR=%~dp0" | |
ECHO waiting for device... | |
adb wait-for-device | |
::mkdir "%TARGET_DIR%" | |
adb exec-out screencap -p > "%TARGET_DIR%%FILE_NAME%" | |
ECHO. | |
ECHO File: "%TARGET_DIR%%FILE_NAME%" | |
start "" "%TARGET_DIR%%FILE_NAME%" |
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
#TARGET_DIR="$HOME/Pictures/adb-screenshots/" | |
TARGET_DIR="$(dirname $0)/" | |
FILE_NAME="$(date +"%Y-%m-%d-%H_%M_%S").png" | |
SCRIPTS_DIR=$(dirname $0) | |
echo "waiting for device..." | |
adb wait-for-device | |
mkdir -p $TARGET_DIR | |
adb exec-out screencap -p > $TARGET_DIR$FILE_NAME | |
echo "" | |
echo "File: $TARGET_DIR$FILE_NAME" | |
xdg-open "$TARGET_DIR$FILE_NAME" & disown |
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
At first, install "settings_apk-debug.apk" from https://github.com/appium/io.appium.settings | |
then: | |
adb shell pm grant io.appium.settings android.permission.CHANGE_CONFIGURATION | |
#en | |
adb shell am broadcast -a io.appium.settings.locale -n io.appium.settings/.receivers.LocaleSettingReceiver --es lang en --es country US | |
#chinese | |
adb shell am broadcast -a io.appium.settings.locale -n io.appium.settings/.receivers.LocaleSettingReceiver --es lang zh --es country CN | |
Thanks to: https://julioevm.github.io/automation/appium/android/2021/02/25/android-locale.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment