I am trying to understand how BroadcastReceivers
work on Android.
My question is, will there be a delay between the time I call sendBroadcast
on a LocalBroadcastManager
to the time it is received in my BroadcastReceiver
? Will the call be synchronous?
For example, when invoking myFunction
, will the output be 21
or 12
??
myFunction {
sendBroadcast;
print "1";
}
myReceiver {
print "2";
}
what if the function running is changed to
myFunction {
sendBroadcast1;
print "1";
sendBroadcast2;
callALotOfOtherFunctions;
}
myReceiver1 {
print "2";
}
myReceiver2 {
print "3";
}
will all the other functions called from myFunction
be called before the receivers?