diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/chrome_custom_tabs/ChromeSafariBrowserManager.java b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/chrome_custom_tabs/ChromeSafariBrowserManager.java index 0a234245..f9207fb0 100755 --- a/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/chrome_custom_tabs/ChromeSafariBrowserManager.java +++ b/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/chrome_custom_tabs/ChromeSafariBrowserManager.java @@ -72,6 +72,9 @@ public class ChromeSafariBrowserManager implements MethodChannel.MethodCallHandl if (CustomTabActivityHelper.isAvailable(activity)) { intent = new Intent(activity, !isSingleInstance ? ChromeCustomTabsActivity.class : ChromeCustomTabsActivitySingleInstance.class); intent.putExtras(extras); + if ((Boolean) options.get("noHistory")) { + intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); + } activity.startActivity(intent); result.success(true); return; diff --git a/lib/src/chrome_safari_browser/android/chrome_custom_tabs_options.dart b/lib/src/chrome_safari_browser/android/chrome_custom_tabs_options.dart index 1fb97365..d6a353a8 100755 --- a/lib/src/chrome_safari_browser/android/chrome_custom_tabs_options.dart +++ b/lib/src/chrome_safari_browser/android/chrome_custom_tabs_options.dart @@ -38,6 +38,9 @@ class AndroidChromeCustomTabsOptions ///Set to `true` to launch the Android activity in `singleInstance` mode. The default value is `false`. bool singleInstance; + ///Set to `true` to launch the Android intent with the flag `FLAG_ACTIVITY_NO_HISTORY`. The default value is `false`. + bool noHistory; + AndroidChromeCustomTabsOptions( {this.addDefaultShareMenuItem = true, this.showTitle = true, @@ -46,7 +49,8 @@ class AndroidChromeCustomTabsOptions this.instantAppsEnabled = false, this.packageName, this.keepAliveEnabled = false, - this.singleInstance = false}); + this.singleInstance = false, + this.noHistory = false}); @override Map toMap() { @@ -58,7 +62,8 @@ class AndroidChromeCustomTabsOptions "instantAppsEnabled": instantAppsEnabled, "packageName": packageName, "keepAliveEnabled": keepAliveEnabled, - "singleInstance": singleInstance + "singleInstance": singleInstance, + "noHistory": noHistory }; } @@ -74,6 +79,7 @@ class AndroidChromeCustomTabsOptions options.packageName = map["packageName"]; options.keepAliveEnabled = map["keepAliveEnabled"]; options.singleInstance = map["singleInstance"]; + options.noHistory = map["noHistory"]; return options; }