Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Commit a7d6d77

Browse files
committed
Fix Android download manager
1 parent 9b1edd2 commit a7d6d77

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,13 +635,20 @@ public void onReceive(Context context, Intent intent) {
635635
boolean exists = new File(customDest).exists();
636636
if(!exists)
637637
throw new Exception("Download manager download failed, the file does not downloaded to destination.");
638+
else
639+
this.callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_PATH, customDest);
638640

639641
} catch(Exception ex) {
640642
error = ex.getLocalizedMessage();
641643
}
642644
}
643-
else
644-
this.callback.invoke("Download manager could not resolve downloaded file path.", RNFetchBlobConst.RNFB_RESPONSE_PATH, null);
645+
else {
646+
if(filePath == null)
647+
this.callback.invoke("Download manager could not resolve downloaded file path.", RNFetchBlobConst.RNFB_RESPONSE_PATH, null);
648+
else
649+
this.callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_PATH, filePath);
650+
}
651+
645652
}
646653
}
647654
}

0 commit comments

Comments
 (0)