What I want: I want to be the first to receive the Sms Broadcast and I want to cancel the broadcast if SMS is of my interest only, so that The broadcast doesn't reach any other app/receiver (Default messaging app etc.). What I know is:
- SmsDisptacher.java uses orderedBroadcasts that can be can canceled/aborted.
What I don't know is:
- If orderedBrodcasts can be canceled for other apps/receivers i.e other than yourself.
what I have tried for being the first to receive the Broadcast:
- intent-filter android:priority="1000"
What i have tried for canceling broadcast already:
- AbortBroadcast();
- broadcastReceiver.setResultCode(RESULT_CANCELED)
- clearAbortBroadcast()
it's possible to do that, i did a tutorial check it please here and here just abort the broadcast on the top of the hierarchy
It is certainly possible. Register your receiver in your manifest like this:
In your receiver's onReceive method write:
Remember to set the permission to receive sms messages in the manifest like this:
Without the correct permission set it will fail silently with the following logcat message:
Finally, it is possible that another application has registered a receiver with an even higher priority than yours, and that it therefore receives the broadcast before you cancel it. So if all else fails, try experimenting with higher priority values.
Got my answer http://groups.google.com/group/android-developers/browse_thread/thread/78fecbc156f4a1ea Its not possible.