Browse Source

Fix Android SDCard path constant #174

Ben Hsieh 8 years ago
parent
commit
e086e9a054
1 changed files with 5 additions and 1 deletions
  1. 5
    1
      src/android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java

+ 5
- 1
src/android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java View File

@@ -197,7 +197,11 @@ public class RNFetchBlobFS {
197 197
         res.put("DownloadDir", Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath());
198 198
         res.put("MovieDir", Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES).getAbsolutePath());
199 199
         res.put("RingtoneDir", Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_RINGTONES).getAbsolutePath());
200
-//        res.put("SDCard", Environment.getExternalStorageDirectory().getAbsolutePath());
200
+        String state;
201
+        state = Environment.getExternalStorageState();
202
+        if (state.equals(Environment.MEDIA_MOUNTED)) {
203
+            res.put("SDCard", Environment.getExternalStorageDirectory().getAbsolutePath());
204
+        }
201 205
         res.put("MainBundleDir", ctx.getApplicationInfo().dataDir);
202 206
         return res;
203 207
     }