mirror of
https://github.com/apache/cordova-plugin-file-transfer.git
synced 2026-02-02 00:00:05 +08:00
fix(android): enable download functionality with Android Q (#310)
This commit is contained in:
@@ -23,6 +23,7 @@ import java.io.ByteArrayOutputStream;
|
|||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.io.FilterInputStream;
|
import java.io.FilterInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
@@ -792,7 +793,7 @@ public class FileTransfer extends CordovaPlugin {
|
|||||||
// write bytes to file
|
// write bytes to file
|
||||||
byte[] buffer = new byte[MAX_BUFFER_SIZE];
|
byte[] buffer = new byte[MAX_BUFFER_SIZE];
|
||||||
int bytesRead = 0;
|
int bytesRead = 0;
|
||||||
outputStream = resourceApi.openOutputStream(targetUri);
|
outputStream = new FileOutputStream(file);
|
||||||
while ((bytesRead = inputStream.read(buffer)) > 0) {
|
while ((bytesRead = inputStream.read(buffer)) > 0) {
|
||||||
outputStream.write(buffer, 0, bytesRead);
|
outputStream.write(buffer, 0, bytesRead);
|
||||||
// Send a progress event.
|
// Send a progress event.
|
||||||
|
|||||||
Reference in New Issue
Block a user