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.
This commit is contained in:
rastafan 2019-03-13 15:32:13 +01:00 committed by GitHub
parent 150292f8e3
commit 60043d7f32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -121,7 +121,7 @@ public class FileOpener2 extends CordovaPlugin {
Context context = cordova.getActivity().getApplicationContext(); Context context = cordova.getActivity().getApplicationContext();
Uri path = FileProvider.getUriForFile(context, cordova.getActivity().getPackageName() + ".opener.provider", file); Uri path = FileProvider.getUriForFile(context, cordova.getActivity().getPackageName() + ".opener.provider", file);
intent.setDataAndType(path, contentType); 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);
} }