SD Card available


Hi guys i wanna make cool apps that can download file from url and save it to sd card if available
The problem is how to check if sd card is installed and how to save??
i do some research but cant find anything useful. thanks for advance…


The file-system core module might be sufficient for what you need
If you really need to know about an SD card - on Android it’s something like the following:

const state = android.os.Environment.getExternalStorageState(); // this returns a string -
if (state === android.os.Environment.MEDIA_MOUNTED) {
  /// should be good to go here

You’d want to wrap this in a platform check if you’re going to also target iOS with your NS app. The platform module has a isAndroid bool that is perfect to check if you’re running on android for this situation.