在Google settings 中,有个backup 选项,在里面选择开启
如果开启,还是在setting里面还是waiting for backup, 就通过手机链接电脑,安装android sdk。通过adb backup
1 adb shell bmgr backupnow --all
通过android 开发文档查看:backup的文件包含:
By default, Auto Backup includes files in most of the directories that are assigned to your app by the system:
- Shared preferences files.
- Files saved to your app's internal storage, accessed by
getFilesDir()
orgetDir(String, int)
. - Files in the directory returned by
getDatabasePath(String)
, which also includes files created with theSQLiteOpenHelper
class. - Files on external storage in the directory returned by
getExternalFilesDir(String)
.
Auto Backup excludes files in directories returned by getCacheDir()
, getCodeCacheDir()
, or getNoBackupFilesDir()
. The files saved in these locations are only needed temporarily, or are intentionally excluded from backup operations.
You can configure your app to include and exclude particular files. For more information, see the Include and exclude files section.
Note: https://developer.android.com/guide/topics/data/autobackup
在android manifest中:
Apps that target Android 6.0 (API level 23) or higher automatically participate in Auto Backup. In your app manifest file, set the boolean value android:allowBackup
to enable or disable backup. The default value is true
1 <manifest ... > 2 ... 3 <application android:allowBackup="true" ... > 4 ... 5 application> 6 manifest>
为防止其他第三方库的默认设置,最好加上tools:replace在application节点上:
1 tools:replace="android:theme,android:allowBackup"