LocalBroadcastManager
has two ways for you to broadcast; sendBroadcast()
and sendBroadcastSync()
. One is synchronous, and the other is asynchronous. sendBroadcastSync()
blocks until the receiver for the first message is done running.
Does LocalBroadcastManager deliver events in the order in which the events wer sent?
-
02-10-2022 - |
Pregunta
I have an activity A and a service S. They commute via LocalBroadcastManager.
If S calls sendBroadcast twice with two messages M1 and M2 in order, will A get M1 before M2?
Thanks,
Solución
Otros consejos
Not necessarily. This call deliver method is asynchronous, there is another way of sending ordered broadcasts (based on permissions, basically the one's that have more permissions get the broadcast earlier than the rest), sendOrderedBroadcast(...)
. You may find more info here.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow