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

API_34 and above requires to use either RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED flags #151

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant