Pick the fix
Registering a runtime receiver crashes on Android 14 with a SecurityException. What's the fix?
Hint 1 of 1
What did Android 14 start requiring for registerReceiver?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A Pass ContextCompat.RECEIVER_NOT_EXPORTED (or EXPORTED if other apps must send to it)
Correct. Android 14 requires an explicit export flag for runtime receivers.
Why not the others?
- B Move it to the manifest. Implicit broadcasts mostly can't be received there.
- C Add android:exported to the Activity. The flag belongs to the receiver registration.
- D Use LocalBroadcastManager. It's deprecated, and only covers in-app broadcasts.