xamarin/Essentials

[Bug] Essentials connectivity - Android 14 Crash - java.lang.SecurityException:One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts(API level 34)[Bug]

pasha-o opened this issue · 7 comments

Description

targeting Api 34 and the emulator - running the Xamarin app with the essential connectivity.

[mono-rt] at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00068] in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/obj/Release/JniEnvironment.g.cs:11524
[mono-rt] at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualObjectMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x00036] in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:867
[mono-rt] at Android.Content.ContextWrapper.RegisterReceiver (Android.Content.BroadcastReceiver receiver, Android.Content.IntentFilter filter) [0x00049] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-33/mcw/Android.Content.ContextWrapper.cs:2464
[mono-rt] at Xamarin.Essentials.Connectivity.StartListeners () [0x00045] in D:\a_work\1\s\Xamarin.Essentials\Connectivity\Connectivity.android.cs:37
[mono-rt] at Xamarin.Essentials.Connectivity.add_ConnectivityChanged (System.EventHandler`1[TEventArgs] value) [0x0001c] in D:\a_work\1\s\Xamarin.Essentials\Connectivity\Connectivity.shared.cs:31

Steps to Reproduce

Reproduction Link

Same issue when using Xamarin.Essentials.Connectivity.ConnectivityChanged on Android 14.

Java.Lang.SecurityException: ' One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts'

Same issue as in MAUI:
dotnet/maui#17861

Would you be able to retrieve the artifacts produced by this PR: #2108 and see if that fixes your issue?

This should be a direct link: https://dev.azure.com/xamarin/6fd3d886-57a5-4e31-8db7-52a1b47c07a8/_apis/build/builds/102499/artifacts?artifactName=nuget&api-version=7.1&%24format=zip

@jfversluis I have tested 1.8.0-pr.2108.1 and it worked fine for me.

Thank you @LeoJHarris !

Larhei commented

backport to net7?

@jfversluis how can I get this fix for xamarin.forms ? I'm not able to see this version "1.8.0-pr.2108.1" in NPM which is mentioned by @LeoJHarris.
could you please help me here.
Thanks!

Note:
I have tried Nightly Feeds but it's not public. ( https://aka.ms/xamarin-essentials-ci/index.json )