我还添加了权限:
但是,我的浏览器仍未显示在设置中浏览器类别的默认应用程序选项中。
我需要对我的应用执行其他操作以使其显示在浏览器的默认选项中吗?
最佳答案
尝试将包括在目标 Activity 的intent-filter中,就像developer documentation所说的那样:If the user is viewing a web page or an e-mail and clicks on a link in the text, the Intent generated execute that link will require the BROWSABLE category, so that only activities supporting this category will be considered as possible actions.
为了从可点击的链接访问intent-filter,这是必需的。没有它,单击链接将无法解析到您的应用程序。
。
附加提示:(如果您想强制将应用程序设为默认浏览器)
Android 6.0(API级别23)及更高版本上的Android App Links允许应用将自身指定为给定类型的链接的默认处理程序。如果用户不希望该应用程序成为默认处理程序,则可以从其设备的系统设置中覆盖此行为。
要为您的应用启用链接处理验证,请在android:autoVerify="true"标签中设置intent-filter:
...