Browse Source

Merge pull request #504 from Bhavik-P/checkKey

Check if addAndroidDownloads map has the notification key before consuming
Travis Nuttall 5 years ago
parent
commit
ca2f93d4a8
No account linked to committer's email address
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java

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

160
             if (options.addAndroidDownloads.getBoolean("useDownloadManager")) {
160
             if (options.addAndroidDownloads.getBoolean("useDownloadManager")) {
161
                 Uri uri = Uri.parse(url);
161
                 Uri uri = Uri.parse(url);
162
                 DownloadManager.Request req = new DownloadManager.Request(uri);
162
                 DownloadManager.Request req = new DownloadManager.Request(uri);
163
-                if(options.addAndroidDownloads.getBoolean("notification")) {
163
+                if(options.addAndroidDownloads.hasKey("notification") && options.addAndroidDownloads.getBoolean("notification")) {
164
                     req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
164
                     req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
165
                 } else {
165
                 } else {
166
                     req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN);
166
                     req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_HIDDEN);