Android Auto Backup

Codelab







 

Who am I?!



Deuphil Kaufmann
@deubaka
SDK Developer @ HyperGrowth
PADC Co-organizer
Java/Android/Mobile

Prerequisite


  • Build tools at least 23.x.x
  • Support library at least 23.x.x
  • Android 6.0 Emulator/Device

    What can it do and when?


    • Auto backups your data to your Google Drive
      • When device is idle
      • When device is charging
      • When device is connected to a Wi-Fi network
      • At least 24hrs has elapsed since the last backup
    • Auto-backup on Android 6.0 and up 
      • Except cache
      • Except external storage
      • Except no-backup-files directory
    • Up to 25MB per app, is encrypted, and free

    How?


    • Do nothing!
      • As long at it is Android 6.0 and up
    • Define an XML scheme (in res/) in android:fullBackupContent under your <application>-declaration in your manifest
    • Domains
      • file
      • database
      • sharedpref
      • external
      • root
    • Include and exclude
    • Disable by setting android:allowBackup to false

    "Testing"


    • Enable system logs for backups
     adb shell setprop log.tag.BackupXmlParserLogging VERBOSE

    • Initiate a backup
     adb shell bmgr run
     adb shell bmgr fullbackup <PACKAGE NAME>
    
    

    • Initiate a restore
     adb shell bmgr restore <PACKAGE NAME>

    Additional notes


    • Pre-Marshmallow devices will need to extend the Backup API and register to Android's Backup Service
      • Device dependent
      • Manual
    • Consider what not to backup
      • Device specific tokens
      • Sensitive or personal info
      • Media





    END

    References and further readings

    DevFest 2015 - Android 6.0 Auto Backup

    By Deuphil Kaufmann (deu)

    DevFest 2015 - Android 6.0 Auto Backup

    A presentation/codelab on Android 6.0 Marshmallow new Auto Backup for GDG DevFest 2015 held at PLDT InnoLab on October 16-17, 2015.

    • 668
    Loading comments...

    More from Deuphil Kaufmann (deu)