Skip to content

Instantly share code, notes, and snippets.

@RightHandedMonkey
Created October 24, 2017 12:20
Show Gist options
  • Save RightHandedMonkey/a3310238ccd82c2f4c6b6dbd823e8d5f to your computer and use it in GitHub Desktop.
Save RightHandedMonkey/a3310238ccd82c2f4c6b6dbd823e8d5f to your computer and use it in GitHub Desktop.
Gets the sqlite database of a debug build of your app
#!/bin/bash
REQUIRED_ARGS=2
ADB_PATH=/Users/Tadas/Library/sdk/platform-tools/adb
PULL_DIR="~/"
if [ $# -ne $REQUIRED_ARGS ]
then
echo ""
echo "Usage:"
echo "android_db_move.sh [package_name] [db_name]"
echo "eg. get_android_db.sh com.rhm.demo database.db"
echo ""
exit 1
fi;
echo""
cmd1="$ADB_PATH -d shell 'run-as $1 cat /data/data/$1/databases/$2 > /sdcard/$2' "
cmd2="$ADB_PATH pull /sdcard/$2 $PULL_DIR"
echo $cmd1
eval $cmd1
if [ $? -eq 0 ]
then
echo ".........OK"
fi;
echo $cmd2
eval $cmd2
if [ $? -eq 0 ]
then
echo ".........OK"
fi;
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment