I have to save huge video files using sdcard. For this reason I want to get sdcard available space to set a time-limit in video recording. Looking for this argument I have found lots of answers in the forum, but in some cases they refer to old Android versions (for what I see actually there is not a directory identifying SdCard) or they show solutions about "DirRootExternal" instead of SdCard.
Is there a way to programmatically get SdCard available space?
thanks in advance
Roberto
I haven't checked the above library and it is worth testing, however I'm not sure that it is possible with the new restrictions on the external storage.
As you wrote, there are many online discussions that confuse between the secondary storage which is confusingly named: getExternalStorageDirectory (=File.DirRootExternal) and a real sd card.
I have checked File Handling library (MLFiles) but simply it doesn't see the SDCard (my device is an android 6.0 - API 23). So I think the library is compatible only for pre-Android 4.4 devices.
The only new library that seems to manage sdcard on Android > 4.4 is ExternalStorage, but actually it has not a method to get space available: could be an interesting add-on?
There must be a way as Cx File Explorer can report size and space available on my Android 8.1 and Android 10 devices.
EDIT: Checking with DexEplorer Cx File Explorer is targeting SDK 29 and the devices are not rooted so it shold be possible in B4A.
As an aside Cx File Eplorer acts as quite a nice image viewer as well as being a neat file explorer. I use it for both now in preference to Ghost Commander and my previous image viewer..
Actually the df command gives me the answer, but how to understand programmatically which is the sd card element? I don't trust that it has always the same name (see the picture)
some idea to identify sd card element?
I have verified on android 6, 7, 10 (samsung) and I confirm that in all these kind of devices the sdcard is mounted on /storage/nnnn-nnnn.
If someone wants to test other devices to confirm this rule is welcome.