androidkotlinandroid-intentbroadcastreceiver

I can't receive the ACTION_USER_PRESENT intent action on android version higher than 11


I can't receive the ACTION_USER_PRESENT Intent on Android Versions above 11. I can however receive the ACTION_SCREEN_OFF Intent Action but not the one stated above as soon as I go above Android 11.

val intentFilter = IntentFilter(ACTION_SCREEN_OFF)
intentFilter.addAction(ACTION_USER_PRESENT)
applicationContext.registerReceiver(eventReceiver, intentFilter, Manifest.permission.READ_PHONE_STATE, null, RECEIVER_NOT_EXPORTED)

I tried to look for changes to the event or its behaviour but I couldn't find anything on the web.


Solution

  • Seems like the app that sends the intent is missing the permission set at the "broadcastPermissions" parameter, if set null and the receiver is set to exported I can receive the intent action again. Appears to be more like a bug on googles side than a undocumented change.