diff --git a/README.md b/README.md index 4b9830d..ae5a68f 100644 --- a/README.md +++ b/README.md @@ -8,4 +8,20 @@ Repo to place STF binaries ``` npm outdated # show outdated package npm update # update all deps -``` \ No newline at end of file +``` + +## Usage of minicap.apk +```bash +./take-screenshot-with-minicap-apk.sh +``` + +But the script is not working on my mobile phone. + +Source can be found in + +Usage ref: + +- +- + + diff --git a/take-screenshot-with-minicap-apk.sh b/take-screenshot-with-minicap-apk.sh new file mode 100755 index 0000000..c6c87ec --- /dev/null +++ b/take-screenshot-with-minicap-apk.sh @@ -0,0 +1,14 @@ +#!/bin/bash -x +# +set -e + +adb push node_modules/@devicefarmer/minicap-prebuilt/prebuilt/noarch/minicap.apk /data/local/tmp/ + +JSON=$(adb shell CLASSPATH=/data/local/tmp/minicap.apk app_process /system/bin io.devicefarmer.minicap.Main -i) + +WIDTH=$(jq ".width" <<< $JSON) +HEIGHT=$(jq ".height" <<< $JSON) +ROTATION=$(jq ".rotation" <<< $JSON) + +adb shell CLASSPATH=/data/local/tmp/minicap.apk app_process /system/bin io.devicefarmer.minicap.Main -P "${WIDTH}x@${HEIGHT}@${WIDTH}x${HEIGHT}/$ROTATION" -Q 80 -s > tmp.jpg +file tmp.jpg