fix(android): enable download functionality with Android Q (#310)

This commit is contained in:
kpatfln 2021-09-24 14:36:25 +10:00 committed by GitHub
parent 2ce746e045
commit cab8b4607a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,6 +23,7 @@ import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
@ -792,7 +793,7 @@ public class FileTransfer extends CordovaPlugin {
// write bytes to file
byte[] buffer = new byte[MAX_BUFFER_SIZE];
int bytesRead = 0;
outputStream = resourceApi.openOutputStream(targetUri);
outputStream = new FileOutputStream(file);
while ((bytesRead = inputStream.read(buffer)) > 0) {
outputStream.write(buffer, 0, bytesRead);
// Send a progress event.