As per the Documentation
Use scoped storage unless your app needs access to a file that's stored outside of an app-specific directory and outside of a directory that the MediaStore APIs can access. If you store app-specific files on external storage, you can make it easier to adopt scoped storage by placing these files in an app-specific directory on external storage. That way, your app maintains access to these files when scoped storage is enabled.
In my case I am creating a text file using below:
File root = new File(this.getExternalFilesDir(null), "sample");
if (!root.exists()) {
root.mkdirs();
}
File file = new File(root, "sample.txt");
Above is creating a file at below location (while having NO SD card available):
/storage/emulated/0/Android/data/<package-name>/files/sample.txt
And I am performing writing operations on it.
Below are the queries:
While referring to the mentioned documents it is still not cleared if Scoped storage enforcement is applicable for the above-mentioned scenario? Do I need to implement the Scoped Storage or It will work without any changes and there is no impact of Android 11 behavior change.
As per my understanding There ks no Impact of Scoped storage enforcement due to Android 11. As I don't have the use case where the app needs access to a file that's stored outside of an app-specific directory. Is this understanding correct?
- In case if I want to read a file that is placed under the Downloads folder, I need to implement the Scoped Storage because my app wants to access the file which is stored outside of an app-specific directory. Is this understanding correct?