Huawei 是否有类似 ChromeCustomTabs 或 SafariViewController 的替代方案?

Is there an alternative for Huawei that works like ChromeCustomTabs or SafariViewController?

ChromeCustomTabs 使用 Chrome,SafariViewController 使用 Safari。有没有华为的替代品(华为浏览器)。我可以将华为浏览器作为应用内浏览器使用吗?

Can I use Huawei Browser as an in-app browser?

可以,华为浏览器支持CustomTabs。

您可以使用以下任一方法启动自定义选项卡:

1.Use支持包提供的public接口。详情如下:

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”);表示开启华为浏览器自定义Tab。您也可以更改其他浏览器的包名来启动其他浏览器的自定义选项卡。

2.Start华为浏览器自定义Tab通过启动intent

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);