Is there a default exit from the SAF OpenSingleFile method if no file available in directory

First of all, we should clarify what you mean by "internal storage". Read my guide "Some basics on Android storage". According to this understanding (according to Google) the "internal storage"

- /data/data/<packageName>/ (assets)
- /data/user/0/<packageName>/files/ (Private directory)

is accessible on all Android versions without READ permissions. However, the assets are read-only, while the PrivateDir is also writable (without WRITE permissions). Neither the assets nor the PrivateDir are accessible via the device unless it is rooted.

Secondly: On Android 11+, non-media files (only in one of the Shared folders) are not readable / writable if they were NOT created by the app itself. This means that a specific app can create a file with Companion (e.g. myTextFile.txt), but then it can't be overwritten with that app's APK. It MUST be deleted beforehand with the app (via Companion) or it MUST have another file name (with the APK).

Once these things are understood, we can then turn to SAF ...

1 Like