'Where is best location to store backups that persist after uninstall/reinstall

My app serves folks that generally work in the backcountry for extended periods without any network access.I would like to be able to auto-store backup copies of their data onboard that would persist even if they uninstall/reinstall when able to access the network at some later time. What is the best folder for this?

My app targets Android 11



Solution 1:[1]

Without any user interaction you can write your files to the public Documents directory using File classes or MediaStore.

At reinstall you should use ACTION_OPEN_DOCUMENT_TREE to let the user choose that directory.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 blackapps