0

I have a relatively old game which currently uses Lollipop target and I want to target the latest API level.

It has a backup & restore functionality which uses the external storage, it exports preferences and game progress into a single file on a single path and don't ask the user anything. It can be restored in either version, at the paid versions first install it even asks the user to restore progress if a backup is found on the device (exported from the free version).

Is there any way I can implement this functionality with the new scoped storage on android 10? I've tried to look around but didn't find any sufficient solution, only prompting a user to a folder which can be confusing. For now I only see the option to implement saving via Google Play Game Services or to prompt the user for folder permission which is confusing and needs a lot of code.

Is there any way to use a single shared folder between my flavors (different package names) on the external storage? It's not a problem if its removed when the app is uninstalled.

Szörényi Ádám
  • 1,223
  • 13
  • 17
  • 1
    I wonder why you dont let the user choose a directory with ACTION_OPEN_DOCUMENT_TREE. Users will get used to do that as there is no alternative. And it does not require a lot of code. Why do you think so? – blackapps Oct 10 '19 at 19:18
  • I think I will give it a try. However current version of the app targets Lollipop, therefor I need to implement the permission as well. And I need to refactor because intent result needs to be processed in Activity code, whereas the current functionality are in separate classes. I think this whole scoped storage adds unnecessary complexity. Google is making Android more and more IOS-like in every version, but that's a different topic. I've just thought that hopefully there's a shared storage between my flavors, but judging from your comment it's not the case. – Szörényi Ádám Oct 10 '19 at 20:08
  • Maybe this can help you? https://stackoverflow.com/questions/6030321/android-retrieving-shared-preferences-of-other-application – blackapps Oct 11 '19 at 08:57
  • Unfortunately MODE_WORLD_READABLE and MODE_WORLD_WRITABLE is deprecated since API Level 17. – Szörényi Ádám Oct 11 '19 at 09:08
  • I've started to implement this feature via SAF with ACTION_CREATE_DOCUMENT and ACTION_OPEN_DOCUMENT. Actually it's easier than I thought, and files are kept after uninstall as well. – Szörényi Ádám Oct 16 '19 at 17:57

0 Answers0