android-customtabs icon indicating copy to clipboard operation
android-customtabs copied to clipboard

Compiling against android P always causes fallback to webview

Open 0xMatthewGroves opened this issue 6 years ago • 0 comments

I'm not sure what has changed, but the same logic that was previously working to open url in a chrome tab no longer works. Compiling against android P may be the culprit. That, or chrome has updated their package name (which is less likely).

The culprit seems to be the following:

// Now packagesSupportingCustomTabs contains all apps that can handle both VIEW intents
// and service calls.
    if (packagesSupportingCustomTabs.isEmpty()) {
        packageNameToUse = null;

Looks like there are no packages supporting custom tabs generated from this chunk of code:

List<String> packagesSupportingCustomTabs = new ArrayList<>();
        for (ResolveInfo info : resolvedActivityList) {
            Intent serviceIntent = new Intent();
            serviceIntent.setAction(CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION);
            serviceIntent.setPackage(info.activityInfo.packageName);
            if (pm.resolveService(serviceIntent, 0) != null) {
                packagesSupportingCustomTabs.add(info.activityInfo.packageName);
            }
        }

0xMatthewGroves avatar Aug 18 '18 04:08 0xMatthewGroves