I want to write a FILE by one APP and read it by another APP ( mainly for testing ).
I run this on the Android Studio emulator.
First I try to resume what I found so far in documentation, and I did some testing .
( This is not quit clear to me and I have some questions )
- The APP has to notify the SYSTEM that it wants to use STORAGE ( = FILES ) :
In : androidManifest.xml
- The APPuser has to give permission :
a) the user can set the permission using : SETTINGS
b) the JAVA code can ask the user for permission :
ActivityCompat.requestPermissions( ..., .... WRITE_EXTERNAL_STORAGE, 1);
- THEN the APP can access files in dir : .....
a) getFilesDir : Internal storage ONLY accessable by: this.APP
b) getExternalStorageDirectory : OLD replaced by : getExternalFilesDir
c) getExternalFilesDir : External storage accessable by any APP
d) getExternalFilesDirs : a list of more external storage locations
===== I hope I am right about this !!!!
BUT :
My main problem .....
I can not access the getExternalFilesDir of another APP, It can see the directory but it is NOT_READABLE !!!
( I am also a bit confused by the documentation : it says :
These files are internal to the application, and not typically visible to the user as media. ????
and a few lines later it says :
any application holding Manifest.permission.WRITE_EXTERNAL_STORAGE can write to these files.
)
REM : the directory can by read by FILES manager
I request the user for permission :
requestPermissions( ..., .... WRITE_EXTERNAL_STORAGE, 1);
This will ask the user permission for : PHOTO's and MEDIA !!!!?????
thanks .....
question from:
https://stackoverflow.com/questions/65948844/i-cannot-access-getexternalfilesdir-by-another-app 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…