Search code examples
androidandroid-10.0

Is there a location to keep app files after app uninstallation in Android Q, except Media collections or Downloads


According to https://developer.android.com/preview/privacy/scoped-storage, an app with sandboxed view can just access files located in app-specific directory or Media collections or Downloads in Android Q.

I'm just confused if I want to keep app files after app being uninstalled where can I write my files, except Media or Downloads directory.

Writing files in inappropriate location is bad, so this question is just to find if it's possible when app works with scoped storage.


Solution

  • I want to keep app files after app being uninstalled where can I write my files

    Use the Storage Access Framework (e.g., ACTION_CREATE_DOCUMENT or ACTION_OPEN_DOCUMENT_TREE). This will allow the user to choose where your app writes the user's data on the device, and most locations that the user might pick will remain around after your app is uninstalled.