Skip to content

Commit fb0c5f1

Browse files
authored
Merge pull request wkh237#87 from vikas5914/master
Fix notification value for android download Manager
2 parents 2a81f32 + 521e0c4 commit fb0c5f1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ If you're going to access external storage (say, SD card storage) for `Android 5
120120
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
121121
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
122122
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
123-
123+
+ <uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />
124124
...
125125

126126
```

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,11 @@ public void run() {
161161
if (options.addAndroidDownloads.getBoolean("useDownloadManager")) {
162162
Uri uri = Uri.parse(url);
163163
DownloadManager.Request req = new DownloadManager.Request(uri);
164-
req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
164+
if(options.addAndroidDownloads.getBoolean("notification")) {
165+
req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
166+
} else {
167+
req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN);
168+
}
165169
if(options.addAndroidDownloads.hasKey("title")) {
166170
req.setTitle(options.addAndroidDownloads.getString("title"));
167171
}

0 commit comments

Comments
 (0)