Alexander Stolte Expert Licensed User Longtime User Jan 19, 2017 #1 Hello, In the theory you get with DirRootExternal the path of an external storage media or sd-card. Is that right? Because with me comes a completely different path out and try to save something under the path it saves it always on the device not on the SD. I add this permission to the manifest editor: B4X: Expand Collapse Copy AddPermission("android.permission.WRITE_EXTERNAL_STORAGE") And writeable is true. Or is there another way to save the sd card? All tutorials I have read have been based on "DirRootExternal"
Hello, In the theory you get with DirRootExternal the path of an external storage media or sd-card. Is that right? Because with me comes a completely different path out and try to save something under the path it saves it always on the device not on the SD. I add this permission to the manifest editor: B4X: Expand Collapse Copy AddPermission("android.permission.WRITE_EXTERNAL_STORAGE") And writeable is true. Or is there another way to save the sd card? All tutorials I have read have been based on "DirRootExternal"
Erel B4X founder Staff member Licensed User Longtime User Jan 20, 2017 #2 No. It returns the path to the secondary storage. On 99% of the devices this will not be an sd card. You can use RuntimePermissions.GetAllSafeDirsExternal to get the path of the only folder that is accessible for your app on the sd card. There are many discussions related to sd cards: https://www.b4x.com/search?query=sd+card Upvote 0
No. It returns the path to the secondary storage. On 99% of the devices this will not be an sd card. You can use RuntimePermissions.GetAllSafeDirsExternal to get the path of the only folder that is accessible for your app on the sd card. There are many discussions related to sd cards: https://www.b4x.com/search?query=sd+card
Alexander Stolte Expert Licensed User Longtime User Jan 21, 2017 #3 I have one more question, I use: GetAllSafeDirExternal, as a result I get 2 paths. The second path is the sd-card. The Problem is, i cant convert an array to string. And if i use this array, i get errors. My Code: B4X: Expand Collapse Copy Dim rp As RuntimePermissions Dim folders As List = rp.GetAllSafeDirsExternal("") Dim List2 As List List2.Initialize List2.AddAll(folders) List2.RemoveAt(0) astream.StreamFolder = List2 Result: B4X: Expand Collapse Copy (ArrayList) [/storage/0123-4567/Android/data/b4a.testing/files] Errors: B4X: Expand Collapse Copy Error: (ErrnoException) android.system.ErrnoException: open failed: ENOENT (No such file or directory) Permission to write on there is set: B4X: Expand Collapse Copy AddPermission("android.permission.WRITE_EXTERNAL_STORAGE") Upvote 0
I have one more question, I use: GetAllSafeDirExternal, as a result I get 2 paths. The second path is the sd-card. The Problem is, i cant convert an array to string. And if i use this array, i get errors. My Code: B4X: Expand Collapse Copy Dim rp As RuntimePermissions Dim folders As List = rp.GetAllSafeDirsExternal("") Dim List2 As List List2.Initialize List2.AddAll(folders) List2.RemoveAt(0) astream.StreamFolder = List2 Result: B4X: Expand Collapse Copy (ArrayList) [/storage/0123-4567/Android/data/b4a.testing/files] Errors: B4X: Expand Collapse Copy Error: (ErrnoException) android.system.ErrnoException: open failed: ENOENT (No such file or directory) Permission to write on there is set: B4X: Expand Collapse Copy AddPermission("android.permission.WRITE_EXTERNAL_STORAGE")
DonManfred Expert Licensed User Longtime User Jan 21, 2017 #4 B4X: Expand Collapse Copy Log(rp.GetSafeDirDefaultExternal("")) this log the only folder on the sdcard which is writeable for your app. Usually it is the second storage (internal!). You dont have access to a third storage (External SDCard) starting from android 5 (or was it 4.4?). I may be wrong Last edited: Jan 21, 2017 Upvote 0
B4X: Expand Collapse Copy Log(rp.GetSafeDirDefaultExternal("")) this log the only folder on the sdcard which is writeable for your app. Usually it is the second storage (internal!). You dont have access to a third storage (External SDCard) starting from android 5 (or was it 4.4?). I may be wrong
Alexander Stolte Expert Licensed User Longtime User Jan 21, 2017 #5 I use Android 6.0.1 So is it no longer possible to write to the sd card? Upvote 0
DonManfred Expert Licensed User Longtime User Jan 21, 2017 #6 Correct Edit: if you have setup your device to use the external storage for app-installations then you may get a path on the external sdcard, But again; only THIS one Folder is writeable for your app. You dont have WRITE-Access to any other folder. You can for sure READ the files on external sdcard using my STORAGE lib. See https://www.b4x.com/android/forum/threads/donmanfreds-overview.54618/ for a list of my libs... It´s the first i published See Example attached Attachments storageex.zip storageex.zip 6.5 KB · Views: 1,274 Last edited: Jan 21, 2017 Upvote 0
Correct Edit: if you have setup your device to use the external storage for app-installations then you may get a path on the external sdcard, But again; only THIS one Folder is writeable for your app. You dont have WRITE-Access to any other folder. You can for sure READ the files on external sdcard using my STORAGE lib. See https://www.b4x.com/android/forum/threads/donmanfreds-overview.54618/ for a list of my libs... It´s the first i published See Example attached
Alexander Stolte Expert Licensed User Longtime User Jan 21, 2017 #7 This is mhhh but then the users have to deal with it. Thank you anyway. Upvote 0
DonManfred Expert Licensed User Longtime User Jan 21, 2017 #8 Yes, it is a restriction of Android. You (and for sure your users) have to deal with it. Upvote 0