Receive incoming SMS in android and tokenize

In this post, we will see how to receive incoming SMS in android, then we will tokenize the received SMS. We will be using the broadcast receiver for this purpose. Basically, a broadcast receiver is a component that responds to system-wide broadcast announcements. Broadcasts can be announced for the actions like when the phone is turned on, or data turned on, screen off, etc. By extending Broadcast receiver in our class we can handle such announcements and then we can perform our actions.

Similarly, for the sake of this tutorial, we will be using a Broadcast receiver, which will announce whenever a new SMS is received. To make your android app to listen for incoming messages, you have to give the below permission, in the android manifest file.

As we are done with giving permission to the android app, now we need to specify which type of broadcast, our application needs, in this tutorial, our application needs SMS RECEIVED in the intent filter.

Now, let us see the coding part, for handling and processing the received SMS. We shall create a normal class, which will be extending the BroadcastReceiver class. And after extending, we shall override its methods, such that we can use, our modified methods, in order to Receive incoming SMS in android and tokenize it.

Yes, that’s it for this post. As now you have received the SMS body, you can create many apps, which can read SMS and perform actions. Just like changing your ringer mode, turning on data, and lots more. In a future post, we will be doing, a tutorial to create an application which can change the User profile by receiving an SMS. If this post was useful, share this with your friends, or got any thing to ask, drop them in the comments below.

Hey there, I’m Sid. I often write articles here. Apart from being a developer, my interest range from blogging, designing, tinkering and hearing electronic. To connect with me, just navigate to any social icons, below!

Sidharth Patnaik

Hey there, I'm Sid. I often write articles here. Apart from being a developer, my interest range from blogging, designing, tinkering and hearing electronic. To connect with me, just navigate to any social icons, below!

Leave a Reply

Your email address will not be published. Required fields are marked *