Android: SMS filter - Can you have priority listener for SMS messages?
I am trying to implement an app that will only listen for a certain header in the SMS. (Parse the sms message and look for some header) That's not hard to do.
The problem is once the app finds the header and knows this SMS is for me, I don't want other app(that has broadcast listener on SMS) to receive SMS. (for exampl开发者_高级运维e, 'messages' to pop-up with sms message)
Is there a way to listen SMS before any other apps and decide to pass on to other app or don't pass to other apps?
See one of the answers for the following question Can we delete an SMS in Android before it reaches the inbox?. It explains how to receive the BROADCAST, set the priority of your app so you receive the broadcast first so you could do your checks then cancel the broadcast so no other app receives it.
Read about BroadcastReceiver. You should use ordered broadcast - use android:priority
attribute, and then call abortBroadcast()
in your BroadcastReceiver.
精彩评论