Merge pull request #269 from AirSuite/master

Fix opening files when targeting android SDK 28
This commit is contained in:
Aaron Faber 2019-11-27 13:52:36 +00:00 committed by GitHub
commit 45f5889ccd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -116,7 +116,7 @@ public class FileOpener2 extends CordovaPlugin {
path = Uri.fromFile(file);
} else {
Context context = cordova.getActivity().getApplicationContext();
path = FileProvider.getUriForFile(context, cordova.getActivity().getPackageName() + ".opener.provider", file);
path = FileProvider.getUriForFile(context, cordova.getActivity().getPackageName() + ".provider", file);
}
intent.setDataAndType(path, contentType);
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_ACTIVITY_NEW_TASK);
@ -124,7 +124,7 @@ public class FileOpener2 extends CordovaPlugin {
} else {
intent = new Intent(Intent.ACTION_VIEW);
Context context = cordova.getActivity().getApplicationContext();
Uri path = FileProvider.getUriForFile(context, cordova.getActivity().getPackageName() + ".opener.provider", file);
Uri path = FileProvider.getUriForFile(context, cordova.getActivity().getPackageName() + ".provider", file);
intent.setDataAndType(path, contentType);
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_ACTIVITY_NO_HISTORY);