Android 11 Internal storage file access

Viewed 317

i have a simple Android App that open an XML file in a known location on internal storage. What i am doing right now is this ( after asking permission READ_EXTERNAL_STORAGE):

inputStream = MyApplication.getInstance().getContentResolver().openInputStream(uri);

To obtain permission to access the file,in Android 10, i added the line android:requestLegacyExternalStorage="true" on the manifest and it's working, but i read that in Android 11 this will not work anymore. I tried reading android developers network but i didn't understand what i'll have to change. The file path and name is hard coded and the file is present under //internalstorage/myAppData/dbcode.xml. Can someone provide me an example of how to simply open and parse an xml file in android 11, without prompting the user with a file picker?

0 Answers
Related