Skip to content

Android 14/API 34 RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED error #2232

Description

@Basewq

Summary

Running on an Android device with Android 14+ will throw an error on the Activity.OnCreate method
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'

As per Google, IntentFilters must explicitly declare RECEIVER_EXPORTED/RECEIVER_NOT_EXPORTED flag or the OS will just crash the app:
https://developer.android.com/develop/background-work/background-tasks/broadcasts#context-registered-receivers

Comments

Requires updated SDL code, eg.
Current code has

mContext.registerReceiver(mUsbBroadcast, filter);

But new SDL properly declares
https://github.com/libsdl-org/SDL/blob/3d42412650119a8e13a016e289e5860c034dde19/android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java#L196-L200

No workaround for Android 14+ due to it baked in the OS.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions