Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save liminal/a726d7bfc441de17c8a3 to your computer and use it in GitHub Desktop.
Save liminal/a726d7bfc441de17c8a3 to your computer and use it in GitHub Desktop.
Set write and read external storage permission prior to a test run so that a screenshot on fail listener can work on device targets running Android 6.0+
SDK=`adb shell getprop ro.build.version.sdk | tr -d '\r'`
echo "Device SDK level is: " $SDK
if (( "$SDK" >= 23 )) ; then
echo "Enabling read and write external storage permissions before running tests on Android 6.0+"
adb shell pm grant com.replace.with.your.app.package android.permission.WRITE_EXTERNAL_STORAGE
adb shell pm grant com.replace.with.your.app.package android.permission.READ_EXTERNAL_STORAGE
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment