my application saves CSV file then it opens it with associated application
I use this code to get storage folder
I ran the application on two different phones, one runs Android 10 the code retuned "/data/user/0/com.etripClient/files/shared"
the other one runs Android 6 and the code returned "/storage/emulated/0/Android/data/com.etripClient/files/shared"
every thing is OK with the Android 6 phone, with the other one, it opens the file with associated application, but I searched for saved file, I did not find it any where on phone storage or SD card, I did not even find 'com.etripclient' folder!
how to fix this?
I use this code to get storage folder
B4X:
Dim StorageDir As String = Starter.Provider.SharedFolder
B4X:
Public Sub Initialize
Dim p As Phone
If p.SdkVersion >= 24 Or File.ExternalWritable = False Then
UseFileProvider = True
SharedFolder = File.Combine(File.DirInternal, "shared")
File.MakeDir("", SharedFolder)
Else
UseFileProvider = False
SharedFolder = rp.GetSafeDirDefaultExternal("shared")
End If
Log($"Using FileProvider? ${UseFileProvider}"$)
End Sub
B4X:
File.WriteString(StorageDir, FileName, Sb.ToString )
B4X:
Dim in As Intent
in.Initialize(in.ACTION_VIEW, "")
Starter.Provider.SetFileUriAsIntentData(in, Filename)
in.SetType("text/csv")
StartActivity(in)
the other one runs Android 6 and the code returned "/storage/emulated/0/Android/data/com.etripClient/files/shared"
every thing is OK with the Android 6 phone, with the other one, it opens the file with associated application, but I searched for saved file, I did not find it any where on phone storage or SD card, I did not even find 'com.etripclient' folder!
how to fix this?