Android - How to intercept SMS messages and prevent them from appearing in the Inbox
Posted by Anuraj on Tuesday, March 31, 2015 Reading time :1 minute
.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.
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. :)
What do you think? I would like to hear your thoughts, suggestions, and questions in the comments section below.