I have one service and two BroadcastReceiver. I am calling first receiver like:
private static final String CALLACTION = "android.intent.action.PHONE_STATE";
final IntentFilter theCallFilter = new IntentFilter();
theCallFilter.addAction(CALLACTION);
yourCallReceiver = new CallReceiver();
registerReceiver(yourCallReceiver, theCallFilter);
and the second one similar like first one.
Now I need to set data from one receiver to another. I want to set Boolean property which will check if the code in first BroadcastReceiver is done something and if is it then code in second can be executed. How can i send this property from “BroadcastReceiver1” to “BroadcastReceiver2” ?
If you simply using a BroadcastRecevier, you can’t be sure the order the system will resolve them in. The answer here is to use ordered Broadcast instead. You can then set the result and check that result in your next receiver.
Here is a great post from the Google Blog http://android-developers.blogspot.com/2011/01/processing-ordered-broadcasts.html