Index: demos/src/main/java/org/chromium/customtabsdemos/CustomTabActivityHelper.java |
diff --git a/demos/src/main/java/org/chromium/customtabsdemos/CustomTabActivityHelper.java b/demos/src/main/java/org/chromium/customtabsdemos/CustomTabActivityHelper.java |
index 3a6175dfcb855a0e4a230a7c3564ee42ced73e19..9cf090d12c48dbeb9cace53f5b35426528beee22 100644 |
--- a/demos/src/main/java/org/chromium/customtabsdemos/CustomTabActivityHelper.java |
+++ b/demos/src/main/java/org/chromium/customtabsdemos/CustomTabActivityHelper.java |
@@ -52,13 +52,26 @@ public class CustomTabActivityHelper implements ServiceConnectionCallback { |
CustomTabsIntent customTabsIntent, |
Uri uri, |
CustomTabFallback fallback) { |
- String packageName = CustomTabsHelper.getPackageNameToUse(activity); |
+ openCustomTab(activity, customTabsIntent, uri, fallback, null); |
+ } |
- //If we cant find a package name, it means theres no browser that supports |
- //Chrome Custom Tabs installed. So, we fallback to the webview |
+ /** |
+ * @see #openCustomTab(Activity, CustomTabsIntent, Uri, CustomTabFallback) |
+ * Same as the previous method, but is able to specify which package the user wants to use. |
+ */ |
+ public static void openCustomTab(Activity activity, |
+ CustomTabsIntent customTabsIntent, |
+ Uri uri, |
+ CustomTabFallback fallback, |
+ String packageName) { |
if (packageName == null) { |
- if (fallback != null) { |
- fallback.openUri(activity, uri); |
+ packageName = CustomTabsHelper.getPackageNameToUse(activity); |
+ //If we cant find a package name, it means theres no browser that supports |
+ //Chrome Custom Tabs installed. So, we fallback to the webview |
+ if (packageName == null) { |
+ if (fallback != null) { |
+ fallback.openUri(activity, uri); |
+ } |
} |
} else { |
customTabsIntent.intent.setPackage(packageName); |