我正在尝试实现自定义Chrome标签.我正在使用Google的默认库customtabs.
我引用本教程来实现自定义chrome选项卡.现在按照教程中的建议,我做了类似的编码.
mCustomTabsServiceConnection = new CustomTabsServiceConnection() {
@Override
public void onCustomTabsServiceConnected(
ComponentName componentName,
CustomTabsClient customTabsClient) {
mCustomTabsClient = customTabsClient;
mCustomTabsClient.warmup(0L);
mCustomTabsSession = mCustomTabsClient.newSession(null);
}
@Override
public void onServiceDisconnected(ComponentName name) {
mCustomTabsClient = null;
}
};
CustomTabsClient.bindCustomTabsService(this, "com.android.chrome",
mCustomTabsServiceConnection);
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(
mCustomTabsSession).setShowTitle(true);
builder.setToolbarColor(getResources().getColor(R.color.purple_main));
builder.setStartAnimations(getApplicationContext(), R.anim.fadein,
R.anim.fadeout);
builder.setExitAnimations(getApplicationContext(), R.anim.fadein,
R.anim.fadeout);
mCustomTabsIntent = builder.build();
Run Code Online (Sandbox Code Playgroud)
并启动自定义标签.
mCustomTabsIntent.launchUrl(TampleDetails.this,
Uri.parse(temple_website));
Run Code Online (Sandbox Code Playgroud)
现在,如您所见,我已将自定义选项卡与chrome的包名绑定,但它仍然要求在Chrome和UC浏览器之间进行选择.很明显UC浏览器不支持自定义标签.
所以我的问题是如何限制自定义标签仅与Chrome浏览器绑定?
任何帮助将不胜感激.
谢谢.