简体   繁体   English

Chrome 自定义标签不会返回应用程序

[英]Chrome Custom Tab does not go back to app

I have a WebView that loads a HTML with links inside.我有一个 WebView,它加载一个带有链接的 HTML。 Those links are opened using Chrome Custom Tabs.这些链接是使用 Chrome 自定义标签打开的。

Strange scenario:奇怪的场景:

  1. Open Chrome browser打开 Chrome 浏览器
  2. Open app打开应用
  3. Press any link (this will open a Chrome Custom Tab)按任意链接(这将打开 Chrome 自定义标签)
  4. Press the back button or the "x" button on the Custom Tab按“自定义”选项卡上的后退按钮或“x”按钮
  5. Instead of going back to the app the chrome browser is shown.显示 chrome 浏览器,而不是返回应用程序。


[updated] The launch mode of my activity, set in the AndroidManifest, is singleInstance. [更新]我在 AndroidManifest 中设置的 Activity 的启动模式是 singleInstance。

The problem is that my activity had the launch mode "singleInstance".问题是我的活动具有“singleInstance”启动模式。 Changing to "singleTask" or not having a launchMode set in the AndroidManifest solves the problem.更改为“singleTask”或未在 AndroidManifest 中设置 launchMode 可以解决该问题。

Don't know why is that.不知道这是为什么。 If you know why, I will gladly mark your explanation as the solution.如果您知道原因,我很乐意将您的解释标记为解决方案。

如果您使用应用程序上下文而不是活动上下文,也会发生这种情况。

add android:noHistory="true" to manifest.xml where you've defined activity.android:noHistory="true"到您定义活动的manifest.xml It is working perfectly它运行良好

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Chrome 自定义选项卡链接不会启动应用程序,但移动版 chrome 浏览器会 - Chrome Custom tab links does not launch the app, but mobile chrome browser does Chrome 自定义标签在 chrome 中作为新标签打开而不是在应用程序内,为什么? - Chrome custom tab opens as a new tab in chrome not inside the app why? “ Chrome自定义标签”是否支持VectorDrawable? - Does “Chrome custom tab” support VectorDrawable? 动作栏和片段出现问题:回到标签页时,应用崩溃 - Problem with the action bar and fragments: the app crashes when go back on a tab Android 应用链接 - 从应用打开 URL 到自定义 chrome 标签 - Android app link - Open URL from app to custom chrome tab 当按下后退按钮时,可以跳过堆栈上的Chrome应用,以返回到我的应用 - To skip chrome app on the stack when the back button is pressed in order to go back to my app android返回特定标签 - android go back to a specific tab 从Chrome自定义标签重定向到Android应用时,“导航被屏蔽” - “Navigation is blocked” when redirecting from Chrome Custom Tab to Android app 本机应用程序和Chrome自定义标签(CCT)之间的通信 - Communication between Native App and Chrome Custom Tab (CCT) 返回上一个应用 - Go back to previous app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM