Skip to content

Commit f1b6974

Browse files
Merge pull request #72 from theely/patch-1
Specify CustomTabsIntent package
2 parents 0cdd110 + 9110114 commit f1b6974

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/android/ChromeCustomTabPlugin.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.json.JSONArray;
2424
import org.json.JSONException;
2525
import org.json.JSONObject;
26+
import org.chromium.customtabsclient.shared.CustomTabsHelper;
2627

2728
public class ChromeCustomTabPlugin extends CordovaPlugin{
2829

@@ -125,8 +126,14 @@ private void show(String url, @ColorInt int toolbarColor, boolean showDefaultSha
125126
builder.addDefaultShareMenuItem();
126127
if(!TextUtils.isEmpty(transition))
127128
addTransition(builder, transition);
129+
128130

129131
CustomTabsIntent customTabsIntent = builder.build();
132+
133+
String packageName = CustomTabsHelper.getPackageNameToUse(cordova.getActivity(), url);
134+
if ( packageName != null ) {
135+
customTabsIntent.intent.setPackage(packageName);
136+
}
130137

131138
startCustomTabActivity(url, customTabsIntent.intent);
132139
}

0 commit comments

Comments
 (0)