1

I have an app that creates a directory for backup files on the external storage and automatically creates backup files when the user exits the app. One backup file per week is created and then one backup file that is overwritten all the time with latest info.

  1. The backup files can't be located in getExternalFilesDir since they needs to survive that the user reinstalls the app.
  2. I can't use MediaStorage because it's not an image or video.
  3. I can't use Storage Access Framework to ask the user every time he exits the app to save a backup file.

So how to automatically create persistent backup files with the new Scoped Storage?

(I also need to list all created backup files, if the user wants to restore one of them.)

4

1 回答 1

-2

备份适用于用户丢失设备、购买新设备、安装应用程序、登录并按原样获取数据的情况。

您的问题似乎是您尝试在用户设备上留下他可能不需要的东西,因为他删除了该应用程序。如果它是许多应用程序可以查看或编辑的图像、音乐、文档等一般文件 - 将它们留在那里并且不在乎。如果它只是您的应用程序数据 - 它们应该在您的应用程序安装时存在并在应用程序删除时消失。

仅备份到云是有意义的。如果您不需要个人服务器,可以选择:实现与 Dropbox 或 Google Drive 的同步。最好的选择是在每次使用该服务关闭应用程序后更新应用程序的数据。

于 2019-11-15T15:12:12.757 回答