nibbo Active Member Licensed User Longtime User Sep 4, 2014 #1 I have read on other threads that you can use File.ExternalWritable to detect an SD card. When I try this however it returns true! There is definitely no SD card in the slot! Code: ' check for an sd card If Not(File.ExternalWritable) Then Msgbox("This application requires an SD card to hold the data and images","Error") Activity.Finish End If As this test failed my app went on to try to create the directories which also worked. They have been created on the internal storage under /storage/emulated/0/... Samsung Galaxy Tab 3 Android version 4.2.2. Any ideas anyone? Thanks
I have read on other threads that you can use File.ExternalWritable to detect an SD card. When I try this however it returns true! There is definitely no SD card in the slot! Code: ' check for an sd card If Not(File.ExternalWritable) Then Msgbox("This application requires an SD card to hold the data and images","Error") Activity.Finish End If As this test failed my app went on to try to create the directories which also worked. They have been created on the internal storage under /storage/emulated/0/... Samsung Galaxy Tab 3 Android version 4.2.2. Any ideas anyone? Thanks
nibbo Active Member Licensed User Longtime User Sep 4, 2014 #2 Just tried it on an older Motorola using 4.0.4 and that does even worse... It does not detect the missing SD card so again it carries on tio try to create the directories which does not fail nor Upvote 0
Just tried it on an older Motorola using 4.0.4 and that does even worse... It does not detect the missing SD card so again it carries on tio try to create the directories which does not fail nor
S sorex Expert Licensed User Longtime User Sep 4, 2014 #3 you could use a TRY/CATCH on a filewrite to File.DirDefaultExternal. I wrote some code last week that downloaded data to that location when I tried it on an out of use phone I got an error and it appeared that there was no SD inthere. So the error catch should give you the notification that there isn't an SD card inserted. Upvote 0
you could use a TRY/CATCH on a filewrite to File.DirDefaultExternal. I wrote some code last week that downloaded data to that location when I tried it on an out of use phone I got an error and it appeared that there was no SD inthere. So the error catch should give you the notification that there isn't an SD card inserted.
nibbo Active Member Licensed User Longtime User Sep 4, 2014 #4 sorex said: you could use a TRY/CATCH on a filewrite to File.DirDefaultExternal. I wrote some code last week that downloaded data to that location when I tried it on an out of use phone I got an error and it appeared that there was no SD inthere. So the error catch should give you the notification that there isn't an SD card inserted. Click to expand... Thanks Sorex, I tried your suggestion and no errors were trapped. So... I had a search around and the file was created in the android/data/<my_app_nams>/files I added a couple of msgbox's and they actually show that File.DirDefaultExternal does indeed point to /storage/emulated/0/android/data/<my_app_name>/files Is this a config setting or something? Thanks again Upvote 0
sorex said: you could use a TRY/CATCH on a filewrite to File.DirDefaultExternal. I wrote some code last week that downloaded data to that location when I tried it on an out of use phone I got an error and it appeared that there was no SD inthere. So the error catch should give you the notification that there isn't an SD card inserted. Click to expand... Thanks Sorex, I tried your suggestion and no errors were trapped. So... I had a search around and the file was created in the android/data/<my_app_nams>/files I added a couple of msgbox's and they actually show that File.DirDefaultExternal does indeed point to /storage/emulated/0/android/data/<my_app_name>/files Is this a config setting or something? Thanks again
S sorex Expert Licensed User Longtime User Sep 4, 2014 #5 strange. Where does it install when you insert the SD? should be something like SD:\Android\Date\appname I believe Upvote 0
strange. Where does it install when you insert the SD? should be something like SD:\Android\Date\appname I believe
nibbo Active Member Licensed User Longtime User Sep 4, 2014 #6 Furthermore... I ran the same tests on the Motorola. This time Files.DirDefauleExternal does point to the sdcard. However, creating and writing a file to the SD card neither works or reports an error! Upvote 0
Furthermore... I ran the same tests on the Motorola. This time Files.DirDefauleExternal does point to the sdcard. However, creating and writing a file to the SD card neither works or reports an error!
nibbo Active Member Licensed User Longtime User Sep 4, 2014 #7 sorex said: strange. Where does it install when you insert the SD? should be something like SD:\Android\Date\appname I believe Click to expand... Sorry Sorex, I am not sure I understand what you are asking me here. If you mean when I install the app, they always go under this /storage/emulated/0/android/data/... It looks like my tablet thinks this is the external storage. I will have a good google and see exactly what this storage/emulated bit means. Thanks again for your time. Upvote 0
sorex said: strange. Where does it install when you insert the SD? should be something like SD:\Android\Date\appname I believe Click to expand... Sorry Sorex, I am not sure I understand what you are asking me here. If you mean when I install the app, they always go under this /storage/emulated/0/android/data/... It looks like my tablet thinks this is the external storage. I will have a good google and see exactly what this storage/emulated bit means. Thanks again for your time.
nibbo Active Member Licensed User Longtime User Sep 4, 2014 #8 OK, I am no further forward with a 'fix'. I can continue developing/testing if I replace File.DirDefaultExternal with '/storage/extSdCard/testdir...' This means my app is not very portable so I would love to know why DirDefaultExternal is not referencing the correct directory. Upvote 0
OK, I am no further forward with a 'fix'. I can continue developing/testing if I replace File.DirDefaultExternal with '/storage/extSdCard/testdir...' This means my app is not very portable so I would love to know why DirDefaultExternal is not referencing the correct directory.
Erel B4X founder Staff member Licensed User Longtime User Sep 4, 2014 #9 File.DirDefaultExtenal as well as the other similar properties / methods provide a reference to the secondary storage. On 99% of the devices this is an internal storage not an SD card. Google is discouraging the usage of the SD card. Starting from Android 4.4 you can only access one specific folder on the sd card. http://www.b4x.com/android/forum/threads/how-to-ext-sd-card-write-on-android-4-4.42177/#post-255351 Upvote 0
File.DirDefaultExtenal as well as the other similar properties / methods provide a reference to the secondary storage. On 99% of the devices this is an internal storage not an SD card. Google is discouraging the usage of the SD card. Starting from Android 4.4 you can only access one specific folder on the sd card. http://www.b4x.com/android/forum/threads/how-to-ext-sd-card-write-on-android-4-4.42177/#post-255351
nibbo Active Member Licensed User Longtime User Sep 8, 2014 #10 Why would Google discourage the use of SD cards? It would be like Microsoft not supporting external drives! Most devices only have 16GB internal store so surely it makes no sense to restrict the entire devices capabilities to that alone? Not questioning your expertise just can't imagine why they would do this! My app will need to access a few thousand images which I was hoping to pre-load on a Micro SD to save users from having to download them from a remote. Now all my users will need to leave a download process running for up-to 45 hours, using their data allowances, when they could just pop an SD card in and have instant access to the images. Sometimes I do wonder what these people are thinking. Upvote 0
Why would Google discourage the use of SD cards? It would be like Microsoft not supporting external drives! Most devices only have 16GB internal store so surely it makes no sense to restrict the entire devices capabilities to that alone? Not questioning your expertise just can't imagine why they would do this! My app will need to access a few thousand images which I was hoping to pre-load on a Micro SD to save users from having to download them from a remote. Now all my users will need to leave a download process running for up-to 45 hours, using their data allowances, when they could just pop an SD card in and have instant access to the images. Sometimes I do wonder what these people are thinking.
S sorex Expert Licensed User Longtime User Sep 8, 2014 #11 just wondering... what kind of app is that that it needs gigs of images? Upvote 0
nibbo Active Member Licensed User Longtime User Sep 8, 2014 #12 sorex said: just wondering... what kind of app is that that it needs gigs of images? Click to expand... Sales presenters. We have over 6000 stock lines (growing all the time) and want to be able to show the images at trade shows etc... Our products can be quite intricate so we do need fairly good resolutions also. We will also want to show them at customer sites where Wi-Fi & 3g are not available, hence the need to store them locally. Upvote 0
sorex said: just wondering... what kind of app is that that it needs gigs of images? Click to expand... Sales presenters. We have over 6000 stock lines (growing all the time) and want to be able to show the images at trade shows etc... Our products can be quite intricate so we do need fairly good resolutions also. We will also want to show them at customer sites where Wi-Fi & 3g are not available, hence the need to store them locally.