Skip to content

Instantly share code, notes, and snippets.

@NicolasBizzozzero
Created July 25, 2023 00:23
Show Gist options
  • Save NicolasBizzozzero/413c9c23fcdbc70209aafa9e4581a0cb to your computer and use it in GitHub Desktop.
Save NicolasBizzozzero/413c9c23fcdbc70209aafa9e4581a0cb to your computer and use it in GitHub Desktop.
Backup android applications & data

Links

1 - Check adb working with current device

adb shell pm list packages -f -3

2.1 - Backup all apks

for APP in $(adb shell pm list packages -3 -f)
do
  adb pull $( echo ${APP} | sed "s/^package://" | sed "s/base.apk=/base.apk /").apk
done

2.2 - Backup all appdata

for APP in $(adb shell pm list packages -3)
do
  APP=$( echo ${APP} | sed "s/^package://")
  adb backup -f ${APP}.backup ${APP}
done

3.1 - Install apks

for APP in *.apk; do
  echo $APP
  adb install $APP
done

3.2 - Install saved appdata

for APP in *.backup; do
  echo $APP
  adb restore $APP
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment