I always used these 2 functions to write and read INI files (in the style of what I used with the old VB6)
But now with Android 10 these functions no longer work.
Here is the mistake :
I tried using FileProvider which I had already successfully used with this instruction, but the result was negative.
With the succession of Android versions, unfortunately, a rewrite of part of the code is required !!!
Thanks in advance for some suggestions.
B4X:
Sub WriteIni(mykey As String,myvalue As String,fPath As String,filename As String)
Dim Map1 As Map
Map1.Initialize
If Not(File.Exists(fPath,filename)) Then
File.WriteMap(fPath, filename, Map1)
End If
Map1 = File.ReadMap(fPath,filename)
Map1.Put(mykey, myvalue)
File.WriteMap(fPath, filename, Map1)
End Sub
Sub ReadIni(key As String,fPath As String,filename As String) As String
Dim Map1 As Map
Map1 = File.ReadMap(fPath,filename)
For i = 0 To Map1.Size - 1
If Map1.GetKeyAt(i) = key Then
Return Map1.GetValueAt(i)
End If
Next
Return ""
End Sub
But now with Android 10 these functions no longer work.
Here is the mistake :
java.io.FileNotFoundException: /storage/emulated/0/AlpVirData/WebCamAlpVir/WebCamAlpVir_Config.txt: open failed: ENOENT (No such file or directory)
I tried using FileProvider which I had already successfully used with this instruction, but the result was negative.
B4X:
File.Copy(File.DirRootExternal, FileName, Starter.Provider.SharedFolder, FileName) ' OK
With the succession of Android versions, unfortunately, a rewrite of part of the code is required !!!
Thanks in advance for some suggestions.