I open audio files from the phone folder "Dowload" so
Dim i As Intent
Dim Vpath = "/sdcard/Download/Vitafon/audio/Regym2.mp3" As String
i.Initialize(i.ACTION_VIEW,Vpath)
'i.SetType("Audio/*")
i.setType("*/*")
StartActivity(i)
I open audio files from the phone folder "Dowload" so
But from the internal folder "Files" my program does not work, I can not correctly register the path.
What needs to be changed in this line?
??? Dim Vpath = "/sdcard/Download/Vitafon/audio/Regym2.mp3" As String ?????
As I understand your question, you want to start a MP3, which is in your File.DirAssets.
So you first have to copy the file to a directory, where also the related Audio Intent App can find/load it.
This is exactly one SUB of the sample Erel shows in his link to FileProvider:
B4X:
Sub btnViewImage_Click
Dim FileName As String = "b4a.png"
File.Copy(File.DirAssets, FileName, Starter.Provider.SharedFolder, FileName)
Dim in As Intent
in.Initialize(in.ACTION_VIEW, "")
Starter.Provider.SetFileUriAsIntentData(in, FileName)
'Type must be set after calling SetFileUriAsIntentData
in.SetType("image/*")
StartActivity(in)
End Sub
I would think, that for audio it is the same procedure....