简体   繁体   English

Android应用程序备份和还原?

[英]Android application backup and restore?

For the application I'm creating, I'd like users to be able to backup their application data (to an SD card for instance). 对于我正在创建的应用程序,我希望用户能够备份其应用程序数据(例如,备份到SD卡)。 What I mean by application data is the preferences and SQLite database. 我所说的应用程序数据是首选项和SQLite数据库。 I'd also like to make it possible to restore the data. 我还想恢复数据。

Is it possible to do this with BackupManager? 是否可以使用BackupManager执行此操作? If yes, can someone give me a simple example. 如果是,有人可以给我一个简单的例子。

BackupManager is for saving your data to the cloud. BackupManager用于将您的数据保存到云中。 To have something backed up to the SDcard, you could write some kind of a service for your application which does this. 要将某些内容备份到SD卡,您可以为应用程序编写某种服务来执行此操作。 All the files/dbs/preferences can be written to a folder. 可以将所有文件/ dbs /首选项写入文件夹。

But, this approach also has a risk if the user formats his SD card or deliberately deletes the folder. 但是,如果用户格式化其SD卡或故意删除该文件夹,则此方法也存在风险。 You can have no control over that. 您对此无能为力。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM