In accordance with the doc:
Note that—beginning with Android 4.4—any attempt by your app to abort the SMS_RECEIVED_ACTION broadcast will be ignored so all apps interested have the chance to receive it.
so, only default SMS app can do it and looks like nothing is changed with Android 5.0 (due to unknown reason, according issue is marked as Obsolete).
Is there any way to block incoming SMS for non-default SMS app if phone is rooted (this is is needed for spam-blocking app)? How to do it?
Make your app the default SMS provider. Then it can register for SMS_DELIVER_ACTION. In that receiver, you can choose to either write the SMS to the database or not. If you choose not to, the SMS is basically ignored. If you choose to, any other app can receive the SMS.
You could write a service that overrides CarrierMessagingService . If the bind to this is successful , then the message is not delivered to the main app.
BIND_CARRIER_MESSAGING_SERVICE
permission required to register as carrier messaging service requires the app to be system app. So you need to push your app to the system.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With