Forked from medyo/extract_realm_database_android.sh
Last active
April 5, 2021 12:35
-
-
Save sudhiryadav/1f8474d444fda25052bdf7b36367565f 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 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 | |
PACKAGE_NAME="com.yourcompanyname.appname" | |
DB_NAME="default.realm" | |
DESTINATION_PATH="/Users/<username>/<Downloads>/" | |
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 "Make sure a device is connected" | |
else | |
adb exec-out run-as ${PACKAGE_NAME} cat files/${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
An excellent way to pull realm database in case of non rooted device.