Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Block incoming SMS on rooted Android 4.4 and higher?

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?

like image 240
LA_ Avatar asked Jul 12 '15 09:07

LA_


2 Answers

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.

like image 129
Gabe Sechan Avatar answered Nov 03 '22 12:11

Gabe Sechan


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.

like image 34
nandeesh Avatar answered Nov 03 '22 12:11

nandeesh