Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save mMarcos208/033e56a4cc0f5f256ef64359598ab904 to your computer and use it in GitHub Desktop.

Select an option

Save mMarcos208/033e56a4cc0f5f256ef64359598ab904 to your computer and use it in GitHub Desktop.
Export realm file from android
#!/bin/bash
ADB_PATH="/home/marconi/Android/Sdk/platform-tools"
#Name of your package
PACKAGE_NAME="XXX"
DB_NAME="default.realm"
DESTINATION_PATH="/home/marconi/Downloads/${DB_NAME}"
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
echo ${ADB_PATH}/adb
${ADB_PATH}/adb exec-out run-as ${PACKAGE_NAME} cat files/${DB_NAME} > ${DESTINATION_PATH}
echo "Database exported to ${DESTINATION_PATH}"
fi
@mMarcos208
Copy link
Author

change .txt to .sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment