Skip to content

Commit

Permalink
Fix runtime error RECEIVER_NOT_EXPORTEr in api34
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesa2 committed Jul 26, 2023
1 parent ad425c3 commit 0311bf4
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,10 @@ class MqttAndroidClient @JvmOverloads constructor(
private fun registerReceiver(receiver: BroadcastReceiver) {
val filter = IntentFilter()
filter.addAction(MqttServiceConstants.CALLBACK_TO_ACTIVITY)
context.registerReceiver(receiver, filter)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
context.registerReceiver(receiver, filter, Context.RECEIVER_NOT_EXPORTED)
} else
context.registerReceiver(receiver, filter)
receiverRegistered = true
}

Expand Down

0 comments on commit 0311bf4

Please sign in to comment.