Skip to content

Conversation

sevbanBayir
Copy link

@sevbanBayir sevbanBayir commented Mar 15, 2024

Location - Create and monitor Geofence sample crashes on API level 34 and above devices.

As per the registerReceiver documentation says:

For apps targeting Build.VERSION_CODES.UPSIDE_DOWN_CAKE, either RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED must be specified if the receiver is not being registered for system broadcasts or a SecurityException will be thrown. See registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter, int) to register a receiver with flags.

It is necessary to use one of these flags when targeting API_34 and above.

Evidence:

Ekran.Kaydi.2024-03-15.23.05.13.mov

Exception:

java.lang.SecurityException: com.example.platform.app: One of RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED should be specified when a receiver isn't being registered exclusively for system broadcasts
at android.os.Parcel.createExceptionOrNull(Parcel.java:3057)
at android.os.Parcel.createException(Parcel.java:3041)
at android.os.Parcel.readException(Parcel.java:3024)
at android.os.Parcel.readException(Parcel.java:2966)
at

There is an additional error when registering a geofence which is again related to API levels when passing a PendingIntent flag to getBroadcast() function located in the same screen above exception thrown. I can create another PR for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant