M madSac Active Member Licensed User Longtime User Jan 31, 2013 #1 I am using some methods those needs URI to be passed...i searched in forum for changing path to uri, i got Code: data="file://" & File.Combine(File.DirInternal, "file.mp3") but when i am using Code: 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 ?
I am using some methods those needs URI to be passed...i searched in forum for changing path to uri, i got Code: data="file://" & File.Combine(File.DirInternal, "file.mp3") but when i am using Code: 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 ?
JonPM Well-Known Member Licensed User Longtime User Jan 31, 2013 #2 Where and how have you placed the mp3 file on the sdcard? Upvote 0
M madSac Active Member Licensed User Longtime User Jan 31, 2013 #3 JonPM said: Where and how have you placed the mp3 file on the sdcard? Click to expand... 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
JonPM said: Where and how have you placed the mp3 file on the sdcard? Click to expand... 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.
Informatix Expert Licensed User Longtime User Jan 31, 2013 #4 madSac said: 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. Click to expand... And if you remove one slash to "file://" ? Could you log the result of "file://" & File.Combine(File.DirRootExternal, "file.mp3") ? Last edited: Jan 31, 2013 Upvote 0
madSac said: 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. Click to expand... And if you remove one slash to "file://" ? Could you log the result of "file://" & File.Combine(File.DirRootExternal, "file.mp3") ?
M madSac Active Member Licensed User Longtime User Jan 31, 2013 #5 Informatix said: And if you remove one slash to "file://" ? Could you log the result of "file://" & File.Combine(File.DirRootExternal, "file.mp3") ? Click to expand... yes i get this in log Code: file:///mnt/sdcard/file.mp3 Upvote 0
Informatix said: And if you remove one slash to "file://" ? Could you log the result of "file://" & File.Combine(File.DirRootExternal, "file.mp3") ? Click to expand... yes i get this in log Code: file:///mnt/sdcard/file.mp3
M madSac Active Member Licensed User Longtime User Feb 5, 2013 #6 Bumping to get solution. Sorry for that. I waited long. Upvote 0
thedesolatesoul Expert Licensed User Longtime User Feb 5, 2013 #7 Informatix already told you the solution in post 4. Use "file:/" instead of "file://" Upvote 0
M madSac Active Member Licensed User Longtime User Feb 6, 2013 #8 I tried to use Code: 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 Code: content://settings/system/notification_sound:ContentDir Upvote 0
I tried to use Code: 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 Code: content://settings/system/notification_sound:ContentDir
Informatix Expert Licensed User Longtime User Feb 6, 2013 #9 madSac said: I tried to use Code: 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 Code: content://settings/system/notification_sound:ContentDir Click to expand... 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 said: I tried to use Code: 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 Code: content://settings/system/notification_sound:ContentDir Click to expand... 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.
M madSac Active Member Licensed User Longtime User Feb 6, 2013 #10 Informatix said: 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. Click to expand... 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: Feb 6, 2013 Upvote 0
Informatix said: 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. Click to expand... 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)
Informatix Expert Licensed User Longtime User Feb 6, 2013 #11 madSac said: 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) Click to expand... 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 said: 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) Click to expand... 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.
M madSac Active Member Licensed User Longtime User Feb 6, 2013 #12 Informatix said: 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. Click to expand... 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
Informatix said: 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. Click to expand... 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 ?
Informatix Expert Licensed User Longtime User Feb 6, 2013 #13 madSac said: Any other solution ? Click to expand... Edit: I just realized that the right path is given by File.DirRootExternal. So that won't solve your problem. Last edited: Feb 6, 2013 Upvote 0
madSac said: Any other solution ? Click to expand... Edit: I just realized that the right path is given by File.DirRootExternal. So that won't solve your problem.
M madSac Active Member Licensed User Longtime User Feb 6, 2013 #14 Can you provide a sample code ? I am just totally bugged up to understand anything . Upvote 0
thedesolatesoul Expert Licensed User Longtime User Feb 6, 2013 #15 The URI from the mediastore is different from the file path. See here: Basic4android - Phone Use AddMediaStore to get the URI and then use that string in SetDefault. Upvote 0
The URI from the mediastore is different from the file path. See here: Basic4android - Phone Use AddMediaStore to get the URI and then use that string in SetDefault.
Informatix Expert Licensed User Longtime User Feb 6, 2013 #16 thedesolatesoul said: The URI from the mediastore is different from the file path. See here: Basic4android - Phone Use AddMediaStore to get the URI and then use that string in SetDefault. Click to expand... I checked this morning. The MediaStore uses the same path returned by File.DirRootExternal. Upvote 0
thedesolatesoul said: The URI from the mediastore is different from the file path. See here: Basic4android - Phone Use AddMediaStore to get the URI and then use that string in SetDefault. Click to expand... I checked this morning. The MediaStore uses the same path returned by File.DirRootExternal.
M madSac Active Member Licensed User Longtime User Feb 6, 2013 #17 thedesolatesoul said: The URI from the mediastore is different from the file path. See here: Basic4android - Phone Use AddMediaStore to get the URI and then use that string in SetDefault. Click to expand... Ok I will have to do that.I didn't wanted to add file in the list . Thank you , thedesolatesoul and informatix for helping me. Upvote 0
thedesolatesoul said: The URI from the mediastore is different from the file path. See here: Basic4android - Phone Use AddMediaStore to get the URI and then use that string in SetDefault. Click to expand... Ok I will have to do that.I didn't wanted to add file in the list . Thank you , thedesolatesoul and informatix for helping me.
J Jost aus Soest Active Member Licensed User Longtime User Feb 7, 2013 #18 BTW: You're not just looking for the path to the external SD Card, are you? If so, try getSDCardPath: External SD Card Root Folder Upvote 0
BTW: You're not just looking for the path to the external SD Card, are you? If so, try getSDCardPath: External SD Card Root Folder