Chrome Custom Tab does not go back to app

老子叫甜甜 提交于 2019-12-01 02:24:24

问题


I have a WebView that loads a HTML with links inside. Those links are opened using Chrome Custom Tabs.

Strange scenario:

  1. Open Chrome browser
  2. Open app
  3. Press any link (this will open a Chrome Custom Tab)
  4. Press the back button or the "x" button on the Custom Tab
  5. Instead of going back to the app the chrome browser is shown.


[updated] The launch mode of my activity, set in the AndroidManifest, is singleInstance.


回答1:


The problem is that my activity had the launch mode "singleInstance". Changing to "singleTask" or not having a launchMode set in the AndroidManifest solves the problem.

Don't know why is that. If you know why, I will gladly mark your explanation as the solution.




回答2:


This can also happen if you use the application context instead of an activity context.



来源:https://stackoverflow.com/questions/38224858/chrome-custom-tab-does-not-go-back-to-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!