xamarin / Essentials

Xamarin.Essentials is no longer supported. Migrate your apps to .NET MAUI, which includes Maui.Essentials.
https://aka.ms/xamarin-upgrade
Other
1.53k stars 505 forks source link

[Bug] Xamarin Essentials Web Authenticator & Open Browser #2070

Closed champcbg closed 1 year ago

champcbg commented 1 year ago

Description

For reference:

https://learn.microsoft.com/en-us/xamarin/essentials/open-browser?context=xamarin%2Fandroid&tabs=android
https://learn.microsoft.com/en-us/xamarin/essentials/web-authenticator?context=xamarin%2Fandroid&tabs=android

I am using both of these features and everything works as expected when I was on an emulator that targeted android 11. It was working without adding the recommended configurations from the documentation above.

when the app is run on an emulator that targets android 13, neither of these features works anymore. the browser just opens and never finished loading the page. If the browser is closed the app will recognize a cancel method was called.

from the documentation, I have tried with and without the configurations and to no avail.

<queries>
        <intent>
        <action android:name="android.support.customtabs.action.CustomTabsService" />
    </intent>
        <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="http"/>
  </intent>
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="https"/>
  </intent>
    </queries>

My original SO question was confirmed by MSFT - https://stackoverflow.com/questions/75011446/xamarin-essentials-web-authenticator-open-browser

Steps to Reproduce

  1. Launch Xamarin Forms app
  2. Click Button web authentication or a browser
  3. they both just hang

Expected Behavior

Open the Browser on target android 13

Actual Behavior

the Browser just hangs on target android 13

Basic Information

Screenshots

image

Reproduction Link

cheles commented 1 year ago

@champcbg some users reported that this tag in AndroidManifest.xml helps

<queries>
        <intent>
            <action android:name="android.support.customtabs.action.CustomTabsService" />
        </intent>
</queries>

https://github.com/xamarin/Essentials/issues/1983#issuecomment-1091914474

jfversluis commented 1 year ago

This might be fixed by #2090 would you be able to try the resulting NuGet package from that PR?