Created
January 29, 2014 11:05
-
-
Save danybony/8685837 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# Based on https://gist.github.com/johnjohndoe/5398030 | |
checkForAndroidDevice() { | |
NOT_PRESENT="List of devices attached" | |
ADB_FOUND=`adb devices | tail -2 | head -1 | cut -f 1 | sed 's/ *$//g'` | |
if [[ ${ADB_FOUND} == ${NOT_PRESENT} ]]; then | |
echo "Android device seems to be missing." | |
return 1 | |
else | |
echo "Android device found." | |
return 0 | |
fi | |
} | |
if ! checkForAndroidDevice; then | |
exit 1; | |
fi | |
# Check for Android version: at least KitKat | |
OS_VERSION=`adb shell getprop ro.build.version.release` | |
if [[ "$OS_VERSION" < "4.4.0" ]]; then | |
echo "Android OS version too old. KitKat or newer needed" | |
exit 1; | |
fi | |
# Create the destination dir, if it does not exists | |
adb shell 'mkdir -p /sdcard/recorded_video' | |
NOW=$(date +%s) | |
FILENAME="rec_$NOW" | |
# Start the recording | |
adb shell screenrecord /sdcard/recorded_video/$FILENAME.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment