Skip to content

Android 12 intent filter exported requirement #42

@dinonovak

Description

@dinonovak

in multiplatform app iOS app works ok, starts, triggers events
for android when trying to run app I am getting
Error AMM0000: android:exported needs to be explicitly specified for element <receiver#crc64c554f6b6abc76285.GeofenceBootReceiver>. Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

I tried fixing this issue by adding below to AndroidManifest.xml under application section

            <receiver
            android:name="crc64c554f6b6abc76285.GeofenceBootReceiver"
            android:enabled="true"
            android:exported="true" /> 

After that app starts OK, but is crashing when trying to start monitoring
CrossGeofence.Current.StartMonitoring(geoSetup);

error is: Object reference not set to an instance of an object. in Plugin.Geofence

at Plugin.Geofence.GeofenceImplementation.RequestMonitoringStart () [0x00000] in <70d71c13fc584d2a938433caf7e25ac4>:0 
  at Plugin.Geofence.GeofenceImplementation.StartMonitoring (Plugin.Geofence.GeofenceCircularRegion region) [0x00061] in <70d71c13fc584d2a938433caf7e25ac4>:0 
  at geofencetest2.MainPage.OnButtonClicked (System.Object sender, System.EventArgs args) [0x0006f] in /geofencetest2/geofencetest2/geofencetest2/MainPage.xaml.cs:34 
  at Xamarin.Forms.Button.Xamarin.Forms.Internals.IButtonElement.PropagateUpClicked () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Button.cs:187 
  at Xamarin.Forms.ButtonElement.ElementClicked (Xamarin.Forms.VisualElement visualElement, Xamarin.Forms.Internals.IButtonElement ButtonElementManager) [0x0001f] in D:\a\1\s\Xamarin.Forms.Core\ButtonElement.cs:61 
  at Xamarin.Forms.Button.SendClicked () [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Button.cs:173 
  at Xamarin.Forms.Platform.Android.ButtonElementManager.OnClick (Xamarin.Forms.VisualElement element, Xamarin.Forms.IButtonController buttonController, Android.Views.View v) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\ButtonElementManager.cs:25 
  at Xamarin.Forms.Platform.Android.FastRenderers.ButtonRenderer.Android.Views.View.IOnClickListener.OnClick (Android.Views.View v) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\FastRenderers\ButtonRenderer.cs:72 
  at Android.Views.View+IOnClickListenerInvoker.n_OnClick_Landroid_view_View_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_v) [0x00010] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/monoandroid10/android-30/mcw/Android.Views.View.cs:2260 
  at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPL_V (_JniMarshal_PPL_V callback, System.IntPtr jnienv, System.IntPtr klazz, System.IntPtr p0) [0x00005] in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:121 
  at (wrapper native-to-managed) Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPL_V(intptr,intptr,intptr)

tried changing android:exported="true" to false, but same error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions