Android Send and Read SMS Tutorial

In android application, SMS allow you to send  to another smartphone user. While you can also implement a broadcast receiver to read the sms receive in the smartphone. Send and Read SMS may useful in some situation in mobile application. Developer can custom a mobile application to send sms by replace the original send sms application in your smartphone. In this tutorial, I will tell you how to use android send and read sms in your project, its just simple.

Creating a New Project

1. Open Android Studio IDE in your computer.
2. Create a new project and Edit the Application name to “SendReadSMSExample”.
(Optional) You can edit the company domain or select the suitable location for current project tutorial. Then click next button to proceed.
3. Select Minimum SDK (API 15:Android 4.0.3 (IceCreamSandwich). I choose the API 15 because many android devices currently are support more than API 15. Click Next button.
4. Choose “Empty Activity” and Click Next button
5. Lastly, press finish button.

Edit activity_main.xml layout

I will add 2 edittext in the layout, the first edittext is to enter the number of user and another field is the message that you wish to send. Besides that, I also add button to perform send sms feature. I also add 2 textview to read the incoming message send by other user or yourself.

Add a new broadcast receiver

Right click your java package and create a new broadcastreceiver to read your message. You can follow the sample code in the bottom.

Edit AndroidManifest.xml

Add receiver in the application section and add SMS permissions as define in the bottom.

Edit class

Lastly, go to your and this class will perform read and send sms function in your project. The source code bottom is the way to implement it.

Run your project

Finally, you can try to send sms to yourself or your friend, it will charge a cost in your sims. You can also read sms in the application.

(Android Send and Read SMS)

Source Code

(Visited 1,821 times, 1 visits today)

Yong Loon Ng

Ng Yong Loon, better known as Kristofer is a software engineer and computer scientist who doubles up as an entrepreneur.

You may also like...

Leave a Reply

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