Send FREE SMS in Java - Receive FREE SMS in Java
Description
Send FREE SMS in Java - Receive FREE SMS in Java using your android mobile device as GSM Modem device or SMS Gateway. You will find great guide and easy steps to learn; How to send or Receive FREE SMS in your Java project.
In this video tutorial we will go step by step to write sample code for sending or receiving FREE SMS in your Java project. Before getting started you must have installed GSM Modem android application in your device so that you could send or receive SMS from your mobile device.
Prerequisites
Before getting started you must have prerequisites.
- You must have an android device.
- GSM Modem Application must be installed on your device.
- GSM Helper Tool must be installed on your device.
- In GSM Modem Application both Servers are started (first for sending sms, second for receiving sms).
- Following Java Jars must be added in your project, comm-2.0, http-2.2.1 and mysql-connector-java-5.1.45-bin.
Code for Sending SMS
Let's write code for sending SMS in Java first. In following Java code you will find message, phone, username, password, address and port of your android device where GSM modem application is listening for input. Create URL from the variable and hit the GET request to device. In the response you see status of the message.
Filename: SMSSender.java
Code for Receiving SMS
In receiving SMS code, We have made HttpServer our own for listening on particular address and port. The above Jars are required for this Java program. In this program we are making complete header request and hostname and port for the use. The listening address and port number must be entered in your device for forward message from your device to Java project.
Filename: MyHttpServer.java