mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 18:12:09 +08:00
fix(android): crash on writeText on Android > 29 (#10466)
Co-authored-by: farfromrefuge <>
This commit is contained in:
@ -375,13 +375,13 @@ public class FileHelper {
|
||||
|
||||
private OutputStream getOutputStream(Context context, Uri uri, boolean append) throws Exception {
|
||||
if (Build.VERSION.SDK_INT >= 19) {
|
||||
if (DocumentsContract.isDocumentUri(context, uri)) {
|
||||
return context.getContentResolver().openOutputStream(DocumentFile.fromSingleUri(context, uri).getUri(), append ? "wa" : "w");
|
||||
}
|
||||
if (isExternalStorageDocument(uri)) {
|
||||
File file = getFile(context, uri);
|
||||
return new FileOutputStream(file, append);
|
||||
}
|
||||
if (DocumentsContract.isDocumentUri(context, uri)) {
|
||||
return context.getContentResolver().openOutputStream(DocumentFile.fromSingleUri(context, uri).getUri(), append ? "wa" : "w");
|
||||
}
|
||||
}
|
||||
return context.getContentResolver().openOutputStream(uri, append ? "wa" : "w");
|
||||
}
|
||||
|
Reference in New Issue
Block a user