更新时间:2023-01-01 17:00:19
String data = "example.com/your_url?param=some_param"
Intent defaultBrowser = Intent.makeMainSelectorActivity(Intent.ACTION_MAIN, Intent.CATEGORY_APP_BROWSER);
defaultBrowser.setData(data);
startActivity(defaultBrowser);
此技术(使用makeMainSelectorActivity)将强制链接在设备的默认浏览器中打开
this technique (using makeMainSelectorActivity) will force the link to open in the device's default browser
注意- makeMainSelectorActivity 仅适用于15级及以上的API。
Note - makeMainSelectorActivity only works for API level 15 and above.
如果您需要支持低于15级的API,您可以尝试此黑客
If you need to support API levels lower than 15, you could try this hack