ChromeCustomTabs使用Chrome,SafariViewController使用Safari。华为(华为浏览器)是否有其他选择?我可以使用华为浏览器作为应用程序内浏览器吗?
发布于 2021-05-07 03:22:21
我可以用华为浏览器作为应用程序内的浏览器吗?
是的,你可以,华为浏览器支持CustomTabs。
可以使用下列任何一种方法启动自定义选项卡:
1.使用支持包提供的公共接口。详情如下:
Maven依赖于支持包。
dependencies {
...
compile 'com.android.support:customtabs:23.3.0'
}然后使用支持包的CustomTabIntent.Builder启动构建。
String url = ¨https://paul.kinlan.me/¨;
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.intent.setPackageName(“com.huawei.browser”);
customTabsIntent.launchUrl(this, Uri.parse(url));customTabsIntent.intent.setPackageName(“com.huawei.browser”);表示要启动华为浏览器的自定义标签。还可以更改另一个浏览器的包名,以启动另一个浏览器的自定义选项卡。
2.启动华为浏览器自定义选项卡。
String url = ¨https://paul.kinlan.me/¨;
Intent customTabsIntent = new Intent(Intent.ACTION_VIEW);
customTabsIntent.setData(Uri.parse(url))) ;
Bundle bundle = new Bundle();
bundle.putBinder(EXTRA_SESSION, null);
customTabsIntent.putExtras(bundle);
customTabsIntent.intent.setPackageName(“com.huawei.browser”);
startActivity(customTabsIntent);https://stackoverflow.com/questions/67416270
复制相似问题