Is it possible for my application to receive an SMS from a specific phone number, without letting it trig a system notification, but let all other messages pass to the default SMS application to be treated normally?
If so, how can the system know which process is first on queue to pick which messages to receive?
I didn’t try this, but in theory it should work:
In Android SMS broadcast is sent as ordered broadcast, which means that receivers are handled in order and can cancel the broadcast. See SMSDispatcher.java, line 420.
In order to be called first, a receiver must have a higher priority then others.
To cancel a broadcast call
broadcastReceiver.setResultCode(RESULT_CANCELED). That way a SMS broadcast will be cancelled and will not be shown by system SMS app (and SMS notifier).Update:
Also try using
broadcastReceiver.setResultCode(Intents.RESULT_SMS_HANDLED).Update 2:
user672601 noted in another answer that this indeed works, but he used
abortBroadcast()inside broadcast receiver.