Forked from medyo/extract_realm_database_android.sh
Created
January 31, 2017 22:55
-
-
Save Soufien/3a7c630fb6fdc0384245866e853db9a3 to your computer and use it in GitHub Desktop.
how to export realm database, full article : http://medyo.github.io/2016/browse-populate-and-export-realm-database-on-android/
This file contains hidden or 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/sh | |
ADB_PATH="/Users/medyo/Library/Android/sdk/platform-tools" | |
PACKAGE_NAME="com.mobiacube.elbotola.debug" | |
DB_NAME="default.realm" | |
DESTINATION_PATH="/Users/Medyo/Desktop/" | |
NOT_PRESENT="List of devices attached" | |
ADB_FOUND=`${ADB_PATH}/adb devices | tail -2 | head -1 | cut -f 1 | sed 's/ *$//g'` | |
if [[ ${ADB_FOUND} == ${NOT_PRESENT} ]]; then | |
echo "Make sure a device is connected" | |
else | |
${ADB_PATH}/adb shell " | |
run-as ${PACKAGE_NAME} cp /data/data/${PACKAGE_NAME}/files/${DB_NAME} /sdcard/ | |
exit | |
" | |
${ADB_PATH}/adb pull "/sdcard/${DB_NAME}" "${DESTINATION_PATH}" | |
echo "Database exported to ${DESTINATION_PATH}${DB_NAME}" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment