From 60043d7f3267ba32c3a45233a6db729394993b7b Mon Sep 17 00:00:00 2001 From: rastafan Date: Wed, 13 Mar 2019 15:32:13 +0100 Subject: [PATCH] Grant Write permission in android intent Added flag Intent.FLAG_GRANT_WRITE_URI_PERMISSION to file opening for android platform, otherwise the program used to open the requested file would not be allowed to save edits. --- .../github/pwlin/cordova/plugins/fileopener2/FileOpener2.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/android/io/github/pwlin/cordova/plugins/fileopener2/FileOpener2.java b/src/android/io/github/pwlin/cordova/plugins/fileopener2/FileOpener2.java index b91e3d9..7c2f71c 100644 --- a/src/android/io/github/pwlin/cordova/plugins/fileopener2/FileOpener2.java +++ b/src/android/io/github/pwlin/cordova/plugins/fileopener2/FileOpener2.java @@ -121,7 +121,7 @@ public class FileOpener2 extends CordovaPlugin { Context context = cordova.getActivity().getApplicationContext(); Uri path = FileProvider.getUriForFile(context, cordova.getActivity().getPackageName() + ".opener.provider", file); intent.setDataAndType(path, contentType); - intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_ACTIVITY_NO_HISTORY); + intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_ACTIVITY_NO_HISTORY); }