SDCard URI

madSac

Active Member
Licensed User
Longtime User
I am using some methods those needs URI to be passed...i searched in forum for changing path to uri, i got
B4X:
data="file://" & File.Combine(File.DirInternal, "file.mp3")
but when i am using
B4X:
data="file://" & File.Combine(File.DirRootExternal, "file.mp3")
no change is done.i have placed file.mp3 in sdcard.
Please tell where i am wrong ?
 

madSac

Active Member
Licensed User
Longtime User
Where and how have you placed the mp3 file on the sdcard?
I have just normally copied mp3 file to sdcard. In its filemanager root...or say first screen of filemanager.
Actually i am trying to change ringtone but using normal path...i.e. without taking user input.
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
I have just normally copied mp3 file to sdcard. In its filemanager root...or say first screen of filemanager.
Actually i am trying to change ringtone but using normal path...i.e. without taking user input.

And if you remove one slash to "file://" ?
Could you log the result of "file://" & File.Combine(File.DirRootExternal, "file.mp3") ?
 
Last edited:
Upvote 0

madSac

Active Member
Licensed User
Longtime User
I tried to use
B4X:
Dim r As RingtoneManager
r.SetDefault(r.TYPE_RINGTONE,"file://mnt/sdcard/ring.mp3")
Log(r.GetDefault(r.TYPE_NOTIFICATION) & ":" &r.GetContentDir)
But no change to place
in log i am always getting
B4X:
content://settings/system/notification_sound:ContentDir
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User

The URI must be the real path to the file, not a symbolic link. On a Nexus 7 for example, /mnt/sdcard is not the real mount point. It's just a symbolic link for /storage/emulated/0.
 
Upvote 0

madSac

Active Member
Licensed User
Longtime User
The URI must be the real path to the file, not a symbolic link. On a Nexus 7 for example, /mnt/sdcard is not the real mount point. It's just a symbolic link for /storage/emulated/0.

I cannot understand. Can you provide an example on what i want to do ?
(Set ringtone from SDCard i do not want to add it in list)
 
Last edited:
Upvote 0

Informatix

Expert
Licensed User
Longtime User
I couldnot understand. Can you provide an example on what i want to do ?
(Set ringtone from SDCard i do not want to add it in list)

I don't know what's the path on your device. You say that the mounting point of your storage card is /mnt/sdcard, but apparently, it's not. Use a file explorer and find the right path. Or you can use my MediaBrowser demo to see the path of your media files.
 
Upvote 0

madSac

Active Member
Licensed User
Longtime User
I don't want to make an app for my device only. I am designing application for every device with 2.3+.
Any other solution ? Will adding to list will do ?
 
Upvote 0

madSac

Active Member
Licensed User
Longtime User
Can you provide a sample code ? I am just totally bugged up to understand anything .
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…