question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android 11 (SDK 30) - Chrome Custom Tabs not available

See original GitHub issue

Plugin version used: 2.0.0

After changing Cordova Target SDK version to 30 (Android 11) and app is running on the device with Android 11, this plugin doesn’t work anymore.

Code that I use

window.SafariViewController.isAvailable((available: any) => {
    if (available) {
        window.SafariViewController.show(
            {
                url: params.url,
                hidden: false,
                animated: true,
                transition: "slide",
                enterReaderModeIfAvailable: false,
                tintColor: "#00ffff",
                barColor: "#000000",
                controlTintColor: "#ffffff",
                showDefaultShareMenuItem: false
            },
            (result: any) => {},
            (err: any) => {}
        );
    }
});

available always returns false.

Any ideas?

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:6
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

12reactions
bbialascommented, Jun 7, 2021

I realized, that this plugin is not able to get available browsers from the device anymore (which supports Custom Tabs).

After reading google documentation: https://developers.google.com/web/updates/2020/07/custom-tabs-android-11#detecting_browsers_that_support_custom_tabs

Following change to config.xml fixed the problem.

<config-file target="AndroidManifest.xml" parent="/manifest">
    <queries>
        <intent>
            <action android:name="android.support.customtabs.action.CustomTabsService" />
        </intent>
    </queries>
</config-file>

Example:

<?xml version='1.0' encoding='utf-8'?>
<widget
    id="xxx"
    version="xxx"
    xmlns="http://www.w3.org/ns/widgets"
    xmlns:cdv="http://cordova.apache.org/ns/1.0"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android-versionCode="xxx"
    ios-CFBundleVersion="xxx"
>
    <name>xxx</name>
    <description>xxx</description>
    <content src="index.html" />
    <access origin="*" />
    ........
    <platform name="android">
        <preference name="android-targetSdkVersion" value="30"/>
        .........
        <config-file target="AndroidManifest.xml" parent="/manifest">
            <queries>
                <intent>
                    <action android:name=
                        "android.support.customtabs.action.CustomTabsService" />
                </intent>
            </queries>
        </config-file>
    </platform>
</widget>
0reactions
dcxncommented, Mar 29, 2022

Hey, same issue and seeing an ERROR {error: "custom tabs are not available"} in my console. And again, thank you all for identifying and proposing solution.

Any ETA for merging the fix and releasing new update?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Custom Tabs with Android 11 - Chrome Developers
When an Android app using Custom Tabs targets SDK level 30 or above ... Intent is not found, an ActivityNotFoundException will be thrown....
Read more >
Error on load Chrome Custom Tab in Android 11
Only error in Android 11 . Here is my code how I put I code in my app. ImageView adCustomBannerImage= findViewById(R.id.adCustomBannerImage); ...
Read more >
Chrome Custom Tabs in Android with Kotlin - GeeksforGeeks
To address this issue, Google launched chrome custom tabs. It is a browser feature that provides apps with more control over their web ......
Read more >
Build for Android 11 with Unity | ARCore - Google Developers
Versions of Unity that do not support customization of Gradle are unable to target Android 11 (API level 30) ( targetSdkVersion 30 )...
Read more >
Fulfill common use cases while having limited package visibility
Open URLs in a browser or other app; Open URLs in Custom Tabs ... which you need to consider if your app targets...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found