Android - How to intercept SMS messages and prevent them from appearing in the Inbox
March 31, 2015 by Anuraj
.Net Android Visual Studio
Android allows app developers to intercept SMS, here is the code snippet, which will help you to get the sms details and if you require you can stop them appearing in the inbox.
First you need to set the permission for the app to receive and process SMS. You can do this by modifing the AndroidManifest.xml file.
Source :
Now you need to write a BroadcastReceiver, which helps to process the SMS message.
And finally you need to register the BroadcastReceiver, you can do this like
You can use this technique to avoid SPAM messages by looking into the number or message content.
Note: You can verify this implementation using android emulator. You can find more details here - SMS Emulation
Happy Programming. :)
Copyright © 2024 Anuraj. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Powered by Jekyll. Hosted with ❤ by GitHub