When sending two intents (One through startService followed by another through startActivityForResult for the sake of an example), does Android guarantee that the first intent (service) is processed before the second (activity)? More specifically in this case, does it guarantee that the Service.onStartCommand is called before the Activity.onCreate?
This is assuming that everything runs within the same process so threading issues from several main threads don’t interfere.
I know that Android doesn’t guarantee the processing order for a single intent (The order of recipients isn’t guaranteed but can be affected by the intent filter priority) but I couldn’t find anything mentioning the order between intents.
Personally I would have thought that, given the single main application thread, the order would be maintained, but I’m facing some bugs that I have hard time explaining unless the order of intents changes.
This should help.
BroadcastReceiver Developer Page
The key bit being that an intent which starts an activity is very different semantically.
It seems like it’d be quite easy to test order by logging.