From 109fb4754ce053a437717d592bd6294bb72940af Mon Sep 17 00:00:00 2001 From: Feng Yu Date: Sat, 1 Jun 2019 12:24:12 +0800 Subject: [PATCH] fix: add Intent.FLAG_ACTIVITY_NEW_TASK flag Add Intent.FLAG_ACTIVITY_NEW_TASK flag when opening a apk file. fix #260 --- .../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 7c2f71c..e96fdbf 100644 --- a/src/android/io/github/pwlin/cordova/plugins/fileopener2/FileOpener2.java +++ b/src/android/io/github/pwlin/cordova/plugins/fileopener2/FileOpener2.java @@ -114,7 +114,7 @@ public class FileOpener2 extends CordovaPlugin { path = FileProvider.getUriForFile(context, cordova.getActivity().getPackageName() + ".opener.provider", file); } intent.setDataAndType(path, contentType); - intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_ACTIVITY_NEW_TASK); } else { intent = new Intent(Intent.ACTION_VIEW);