Android backup service - when and how often to backup?

前端 未结 2 765
北恋
北恋 2020-12-29 08:04

I want to backup my app\'s data using Android backup service, but I\'m concerned about network usage. I have about 500KB of data that needs to be uploaded for each backup op

2条回答
  •  轮回少年
    2020-12-29 08:56

    I've dove further on researching the Android Backup Manager Service and discovered the following:

    1. According to "Requesting Backup Section" in http://developer.android.com/guide/topics/data/backup.html "If you call dataChanged() several times consecutively, before the Backup Manager requests a backup from your agent, your agent still receives just one call to onBackup()."

    I interpret this as each DataChanged() call in our App notifies the Backup Manager Service via transport. The Backup Manager Service will only perform ONE call to our App's Backup Agent's onBackup(), even if DataChanged gets called several times before the Backup Manager Service responds when it wants to (see item 2 below on Backup Manager respond frequency).

    1. According to this Tester (I also ran a backup frequency test just now): https://advancedweb.hu/2014/12/09/practical_measurement_of_the_android_backup_manager/ The Backup Manager Service responds every hour (I also proved this in my tests) as long as at least one DataChanged() was called in-between the hour since the last data backup.

提交回复
热议问题