Hi,
I'm working on resources located in the folder: android/data.
System: Android 12.
In the Manifest editor I added:
AddPermission(android.permission.READ_EXTERNAL_STORAGE)
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(android.permission.MANAGE_EXTERNAL_STORAGE)
SetApplicationAttribute(android:requestLegacyExternalStorage, true)
and I can't read the contents of the selected file. Instead of this
I have an error message on the line:
What am I doing wrong?
I'm working on resources located in the folder: android/data.
System: Android 12.
In the Manifest editor I added:
AddPermission(android.permission.READ_EXTERNAL_STORAGE)
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
AddPermission(android.permission.MANAGE_EXTERNAL_STORAGE)
SetApplicationAttribute(android:requestLegacyExternalStorage, true)
and I can't read the contents of the selected file. Instead of this
I have an error message on the line:
What am I doing wrong?
Example:
'The ExternalFile returned from ListFiles cannot be used directly.
'We need to first call FindFile.
f = Storage.FindFile(GetCurrentFolder, f.Name)
If f.IsFolder Then
EnterFolder(f)
Else If IsFileINI(f.Name) Then
Try
Private outputstream As OutputStream = File.OpenOutput(File.DirInternal,"temp.ini",True)
Private inputstreams As InputStream = Storage.OpenInputStream(f) '---> ERROR: (FileNotFoundException) java.io.FileNotFoundException:
'open failed: EACCES (Permission denied).
' Save file
Wait for (File.Copy2Async(inputstreams, outputstream)) Complete (isCopy As Boolean)
If inputstreams.IsInitialized Then inputstreams.Close
If outputstream.IsInitialized Then outputstream.Close
...
End if
'Open an input stream that reads from the file.
Public Sub OpenInputStream(EF As ExternalFile) As InputStream
Return ctxt.RunMethodJO("getContentResolver", Null).RunMethod("openInputStream", Array(EF.Native.RunMethod("getUri", Null)))
End Sub