I'm using two receivers. One declared in the manifest like this :
<receiver
android:name="com.app.receivertest"
android:exported="false"
android:enabled="true"
android:permission="MY_PERMISSION">
<intent-filter android:priority="0">
<action android:name="NAME_ACTION" />
</intent-filter>
</receiver>
And one declared in my activity A, declared with priority 1.
When I start my service on this activity A, on Android 4.4.2, both receivers are called, in the "correct order" whereas in Android 5 > 0, just the correct receiver declared in the activity A is called, not the manifest's receiver.
This is my code in the receiver used in the activity a :
@Override
public void onReceive(Context context, Intent intent) {
Utils.log("onReceive test");
abortBroadcast();
setResultData("test");
myfunction();
}
after this code, the other receiver is called. I tried to use "setResultData", to use "getResultData" in the other receiver for don't execute the code if I've something, but getResultData returns always null..
So, why both receivers are called ? What happens on Android 4.4 ? I need your help :D
EDIT : Code for sending broadcast :
Intent broadcastIntent = new Intent();
broadcastIntent.setAction(My_ACTION);
sendOrderedBroadcast(broadcastIntent, My_PERMISSION);