Skip to content

Commit 6393497

Browse files
Ron RadtkeRon Radtke
authored andcommitted
Merge commit '3d8417302966d5da2cbf895ac337b38da817d8ec'
2 parents 94cab1f + 3d84173 commit 6393497

File tree

3 files changed

+1
-51
lines changed

3 files changed

+1
-51
lines changed

README.md

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -566,38 +566,6 @@ RNFetchBlob.config({
566566
.then(...)
567567
```
568568

569-
## React Native developers to access android device path for app bundle
570-
571-
```js
572-
NativeModules.RNFetchBlob.getAppDir((error, path) => {
573-
574-
//here path is your apps directory in mobile device
575-
576-
RNFetchBlob
577-
578-
.config({
579-
addAndroidDownloads : {
580-
useDownloadManager : true, // <-- this is the only thing required
581-
// Optional, override notification setting (default to true)
582-
notification : false,
583-
// Optional, but recommended since android DownloadManager will fail when
584-
// the url does not contains a file extension, by default the mime type will be text/plain
585-
mime : 'text/plain',
586-
description : 'File downloaded by download manager.'
587-
}
588-
})
589-
.fetch('GET', 'http://example.com/file/somefile')
590-
.then((resp) => {
591-
// the path of downloaded file
592-
resp.path()
593-
})
594-
})
595-
```
596-
In case error appears or app crash just go to
597-
AndroidMaifest.xml file and add
598-
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
599-
600-
601569
**Open Downloaded File with Intent**
602570

603571
This is a new feature added in `0.9.0` if you're going to open a file path using official [Linking](https://facebook.github.io/react-native/docs/linking.html) API that might not work as expected, also, if you're going to install an APK in `Downloads` app, that will not function too. As an alternative, you can try `actionViewIntent` API, which will send an ACTION_VIEW intent for you which uses the given `MIME` type.

android/src/main/AndroidManifest.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020

2121
<!-- Required to read and write the expansion files on shared storage -->
2222
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
23-
24-
<!-- Required to disable download notification -->
25-
<uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
2623

2724
<application android:label="@string/app_name">
2825

android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -297,22 +297,7 @@ static public void getSDCardApplicationDir(ReactApplicationContext ctx, Promise
297297
promise.reject("RNFetchBlob.getSDCardApplicationDir", "External storage not mounted");
298298
}
299299
}
300-
// method for android
301-
public static String getSDCardApplicationDir(ReactApplicationContext ctx) {
302-
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
303-
try {
304-
final String path = ctx.getExternalFilesDir(null).getParentFile().getAbsolutePath();
305-
return path;
306-
} catch (Exception e) {
307-
e.printStackTrace();
308-
return "";
309-
}
310-
} else {
311-
Log.d("getSDCardApplicationDir","media is not mounted");
312-
return "";
313-
}
314-
}
315-
300+
316301
/**
317302
* Static method that returns a temp file path
318303
* @param taskId An unique string for identify

0 commit comments

Comments
 (0)