custom chrome tabs asks for multiple browser to choose

前端 未结 4 1658
轻奢々
轻奢々 2020-12-08 22:14

I am trying to implement custom chrome tabs. I am using Google\'s default library customtabs.

I referred this tutorial for implementing custom chrom

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-08 23:07

    you can avoid this problem by specifying the package name like this intentCustomTabs.intent.setPackage("com.android.chrome");

    full code :

        String url = link;
        CustomTabsIntent.Builder builderCustomTabs = new CustomTabsIntent.Builder();
        CustomTabsIntent intentCustomTabs = builderCustomTabs.build();
        intentCustomTabs.intent.setPackage("com.android.chrome"); 
        intentCustomTabs.intent.addFlags(new Integer("67108864"));
        builderCustomTabs.setShowTitle(true); 
        builderCustomTabs.setToolbarColor(ContextCompat.getColor(this, R.color.colorPrimary));
        builderCustomTabs.enableUrlBarHiding();
        intentCustomTabs.launchUrl(this, Uri.parse(url));
    

提交回复
热议问题