Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java.Lang.IllegalArgumentException: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.' #45

Open
BhargavSai-17 opened this issue May 24, 2024 · 0 comments

Comments

@BhargavSai-17
Copy link

Hello @rdelrosario ,

I'm encountering an issue while trying to implement the Geofencing feature in my MAUI application targeting Android 34 (Android 14.0). When attempting to start monitoring a region, I receive the following exception:

Java.Lang.IllegalArgumentException: 'namespace': Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.'

I noticed that the Plugin.Geofence library uses PendingIntent.UpdateCurrent. Following the latest Android policies, I modified the PendingIntentFlags to Mutable instead of UpdateCurrent and rebuilt the solution, generating the Plugin.Geofence.dll.

I built the DLL based on the MonoAndroid10.0 framework and installed the necessary packages:

  • Xamarin.Android.Support.V4 - 28.0.0.3
  • Xamarin.AndroidX.Legacy.Support.V4 - 1.0.0.6
  • Xamarin.AndroidX.Migration - 1.0.8
  • Xamarin.GooglePlayServices.Location - 120.0.02

With these changes, I could create a geofence without encountering the above-mentioned exception. However, the geofencing events (Entry, Exit, and Stayed) are not triggering correctly. Specifically, the Entry event triggers immediately upon starting monitoring, even when the device is not within the geofence.

Could you provide guidance or support to resolve this issue? Any assistance in making the plugin fully compatible with higher Android versions would be greatly appreciated.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant