关闭 chrome 个自定义选项卡
Closing chrome custom tab
在我的用例中,我有一个很深 link 返回到我的应用程序的页面。当我在 Chrome 自定义选项卡中打开此页面时,我可以通过单击深度 link 返回到我的应用程序,但问题是当我单击设备后退按钮时, chrome 选项卡仍然可见。
有什么方法可以在用户返回我的 app/activity 时关闭 chrome 自定义选项卡。
打开 chrome 自定义选项卡时设置以下标志似乎可以解决我的问题
http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_NO_HISTORY
正如@Jaspinder Kaur 提到的:您需要在您的标志上添加:
mCustomTabsIntent = new CustomTabsIntent.Builder().build();
mCustomTabsIntent.intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY)
和:
如果您将应用设置为 singleInstance
或 singleTop
,那么当您使用 Intent 返回到它时,框架也会完成自定义选项卡 activity。
在我的用例中,我有一个很深 link 返回到我的应用程序的页面。当我在 Chrome 自定义选项卡中打开此页面时,我可以通过单击深度 link 返回到我的应用程序,但问题是当我单击设备后退按钮时, chrome 选项卡仍然可见。
有什么方法可以在用户返回我的 app/activity 时关闭 chrome 自定义选项卡。
打开 chrome 自定义选项卡时设置以下标志似乎可以解决我的问题 http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_NO_HISTORY
正如@Jaspinder Kaur 提到的:您需要在您的标志上添加:
mCustomTabsIntent = new CustomTabsIntent.Builder().build();
mCustomTabsIntent.intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY)
和:
如果您将应用设置为 singleInstance
或 singleTop
,那么当您使用 Intent 返回到它时,框架也会完成自定义选项卡 activity。