A particular receiver can only process one broadcast at a time. As each broadcast happens, it is processed to determine the targets it should go to, and dispatched into the message queue for each target. When a later broadcast is sent, it will generally not be moved ahead of the queue.
For the screen on/off broadcasts, you can rely on the most recent broadcast you get being the current state of the screen. once everything has settled down. You can't rely on ordering with any other broadcasts, or other broadcast receivers that may also be receiving the broadcasts. On Mon, Mar 26, 2012 at 3:49 AM, Put_tiMe <putt...@gmail.com> wrote: > I have a class which is derived from 'BroadcastReceiver'. > Here I've signed up for screen-off, screen-on, battery-changed and > user-present intents. > > I want to know how my class receives messages. > > Are they received in the order they were raised? > > Or is there a chance that messages could arrive out of order. > > Ex. assume the screen was on. Now I switch it off, and immediately switch > it back on. Then I switch it off immediately. Then I switch it on > immediately. > I'm talking about this whole sequence of events happening in less than a > second. > > In this case will I be receiving the messages in this order: > 1. Off > 2. On > 3. Off > 4. On > > > Is there any chance they can be out of order? > > > Thanks > > > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en