Reputation: 992
I have an application that expects SMS messages in certain formats. If a SMS message meets specific criteria set out by my app, I want to prevent the re-broadcast of the SMS, otherwise allow it to proceed to other BroadcastReceiver (like the default SMS reader).
Does anyone know how this can be achieved?
public void onReceive(Context context, Intent intent) {
String msg = processMessageFromIntent(intent);
if(needed(msg)){
//prevent propagation;
}
}
Upvotes: 1
Views: 470
Reputation: 1097
This will only work if the intent has been sent with Context.sendOrderedBroadcast
as per BroadcastReceiver.
So, you have to check with the broadcast you want to handle.
Upvotes: 0
Reputation: 992
The solution was to set a hight priority for the receiver and call abortBroadcast.
Upvotes: 1