Essentials
Essentials copied to clipboard
Xamarin.Essentials.Browser.OpenAsync on Samsung Galaxy M31
This issue has been moved from a ticket on Developer Community.
[severity:It bothers me. A fix would be nice] This is PRODUCTION issue. Line code: Browser.OpenAsync(url, BrowserLaunchMode.External); First happen after adding "await ", did not use it with async until now (don't now if related, just mentioning) Recently Xamarin.Essentials 1.70 Xamarin.Forms 5.0.0.2196
android.runtime.JavaProxyThrowable:
at Xamarin.Essentials.Browser.PlatformOpenAsync (System.Uri uri, Xamarin.Essentials.BrowserLaunchOptions options) \[0x00164\] in :0
at Xamarin.Essentials.Browser.OpenAsync (System.Uri uri, Xamarin.Essentials.BrowserLaunchOptions options) \[0x00006\] in :0
at Xamarin.Essentials.Browser.OpenAsync (System.String uri, Xamarin.Essentials.BrowserLaunchOptions options) \[0x0001e\] in :0
at Xamarin.Essentials.Browser.OpenAsync (System.String uri, Xamarin.Essentials.BrowserLaunchMode launchMode) \[0x0000d\] in :0
at MyApp.StartPage.OpenUrl (System.String url) \[0x0000a\] in :0
at MyApp.StartPage.LinksMenuClicked (System.Object sender, System.EventArgs e) \[0x001d9\] in :0
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b\_\_7\_0 (System.Object state) \[0x00000\] in :0
at Android.App.SyncContext+<>c\_\_DisplayClass2\_0.b\_\_0 () \[0x00000\] in :0
at Java.Lang.Thread+RunnableImplementor.Run () \[0x00008\] in :0
at Java.Lang.IRunnableInvoker.n\_Run (System.IntPtr jnienv, System.IntPtr native\_\_this) \[0x00008\] in :0
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.41(intptr,intptr)
at mono.java.lang.RunnableImplementor.n\_run (Native Method)
at mono.java.lang.RunnableImplementor.run (RunnableImplementor.java:30)
at android.os.Handler.handleCallback (Handler.java:938)
at android.os.Handler.dispatchMessage (Handler.java:99)
at android.os.Looper.loop (Looper.java:246)
at android.app.ActivityThread.main (ActivityThread.java:8595)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:602)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1130)
Original Comments
Feedback Bot on 10/21/2021, 06:17 PM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
Original Solutions
Tomer Zilka solved on 10/24/2021, 05:22 AM, 0 votes:
[Workaround]
Update:
Android 11 throws when using BrowserLaunchMode.External:
await Browser.OpenAsync(url, BrowserLaunchMode.External);
“Xamarin.Essentials.FeatureNotSupportedException: ‘Specified method is not supported.’”
When using BrowserLaunchMode.SystemPreferred it works sleek.
The issue is not related to the device, I have the same issue on Oppo phone with Android 11 and BrowserLaunchMode.External.
Also happening on Samsung Galaxy M11 Android 11
I have same problem on Nokia 5.3 Android 11 with BrowserLaunchMode.External when I changed it to BrowserLaunchMode.SystemPreferred it works.
Solution for this issue is here. If your project target Android version is set to Android 11 (R API 30) you must update your Android Manifest.
Add the following inside of the manifest node:
<queries>
<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>
Solution for this issue is here. If your project target Android version is set to Android 11 (R API 30) you must update your Android Manifest.
Add the following inside of the manifest node:
<queries> <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>
I have includes these queries, and even with this specified, i got this error on several Galaxy devices, LG K9, Xperia L3 running on Android 10 and 11
What is the url scheme? http/https? or is it a custom uri?
BrowserLaunchMode.External does not work on android device with android 11+ It crashes with FeatureNotSupportedException Tested on multiple devices.
Is that more related to the new "query" attribute required for app targeting api 30 ?
https://medium.com/androiddevelopers/package-visibility-in-android-11-cc857f221cd9
Duplicate of #1958 ?
Solution for this issue is here. If your project target Android version is set to Android 11 (R API 30) you must update your Android Manifest.
Add the following inside of the manifest node:
<queries> <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>
After adding this code and then doing a Clean & Compile on all projects works perfect!