I am trying to implement custom chrome tabs. I am using Google\'s default library customtabs.
I referred this tutorial for implementing custom chrom
Check this stackoverflow answer: if you set the CustomTabIntent package with the package of your desired browser before launch the url, you can skip the Android dialog browser choice; for me it worked:
/**
* Opens the URL on a Custom Tab
*
* @param activity The host activity.
* @param uri the Uri to be opened.
*/
public static void openCustomTab(Activity activity,
Uri uri) {
// Here is a method that returns the chrome package name
String packageName = CustomTabsHelper.getPackageNameToUse(activity, mUrl);
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
mCustomTabsIntent = builder
.setShowTitle(true)
.build();
builder.setToolbarColor(ContextCompat.getColor(activity, R.color.colorPrimary));
if ( packageName != null ) {
mCustomTabsIntent.intent.setPackage(packageName);
}
mCustomTabsIntent.launchUrl(activity, uri);
}