Android:防止应用程序打开自己的链接
我有一个可以打开特定网站的网络链接的应用程序。 为了促进使用情况,该应用程序还可以选择在用户的Web浏览器中打开该应用程序的当前页面。 不幸的是,如果用户在与应用程序打开链接时选择“始终”选项,则他将无法从应用程序中打开其Web浏览器中的链接。 有办法解决吗?
I have an app that can open web links to a specific website.
To facilitate usage, the app also has an option to open the current page of the app in the user's web browser.
Unfortunately, if the user chooses the "Always" option when opening a link with the app, he can no longer open the links in his web browser from the app.
Is there a way around this ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下方法适用于所有隐性意图 - 不仅限于您有关浏览器的问题。
当您发出隐式意图(例如Action_View)时,主机Android设备将检查是否有一个默认应用程序可以处理意图。如果有默认应用程序,则默认情况下,Android将自动重定向到该应用程序。
但是,您可以强迫应用程序选择器以达到隐式意图。为此,您需要使用
intent.CreateChooser()
方法。请参阅此示例:The following method works for all implicit intents - not limited to your question about browsers.
When you issue an implicit intent (like ACTION_VIEW), the host Android device will check to see whether there is a default app to handle the intent. If there is a default app, then, by default, android will automatically redirect to the app.
However, you can force an app chooser for implicit intents. For this, you need to use
Intent.createChooser()
method. See this example: