On some questions here on SOverflow I found THIS. But it says that it is not avaiable at the moment and probably it will never get avaiable.
Based on THIS I realised that there is no need on building my own SMS service.
So the question:
My java application has to send SMS messages to users and receive SMS messages from users. Do I really need to pay some SMS gateway or is there some free SMS GATEWAY (with some limitations ofcourse) that I could use to test my application?
Simplewire Kit looks really simple but the demo examples are failing because I don' have Simplewire account. Simplewire documentation says that there is a 30-day trial for sending SMS. But this is for two way:
"For 2-Way, demo credits are not available because you will need your own mobile number hosted on Simplewire’s Network. Simplewire supports 2-Way numbers for many different countries and area codes. Please contact Simplewire for more information."
FYI Simplewire is now OpenMarket.com/MXTelecom.com
There are a couple of free SMS gateways but they all attach a SMS ad in your message to pay for the cost. ZeepMobile is the one I hear about the most. As for paying there are a couple of solution but this all depends on your needs.
Two way communication would require the end user to subscribe to your service. There are a few ways to approach this:
Short Code: you could get your own (www.openmarket.com) or share with others (www.clickatell.com) You could use a new service www.twilio.com looks to be good but haven't tested it yet.
If one way communication is all you need you could so something like email to gateway sms but then you would need to know the carrier the end user is on.
Fowiz offers free Android based solution to send/receive text messages from applications. You need to install their Android App on your device to enable this service and the messages are sent/received on your phone. You can setup CallbackUrl to receive instant notification on the incoming messages. Fowiz also supports short codes, campaign management, voting etc.
Sample code to send message via Fowiz:
String myPasscode = 'your passcode';
String myUsername = 'your fowiz username';
String toPhoneNumber = 'recipient phone number';
String myMessage = 'your message';
HttpClient client = new DefaultHttpClient();
HttpGet request = new HttpGet(HTTP_API + "?username="+myUsername
"&phonenumber="+toPhoneNumber
+"&message="+myMessage+"&passcode="+myPasscode);
HttpResponse response = client.execute(request);
BufferedReader rd = new BufferedReader
(new InputStreamReader(response.getEntity().getContent()));
String line = "";
StringBuffer response = new StringBuffer();
while ((line = rd.readLine()) != null) {
response.append(line);
}
System.out.println(response.toString());
Source: http://cloud.fowiz.com/2help.html
Yes you can build an API your own within 5 minutes. Your android phone can work as Server API to send and receive SMS in your Java code. It is very simple to do that. there are the some basic steps
If you want to learn step by step. there is also guide and video tutorial. Send or receive FREE SMS in Java
public class SMSSender {
public static void main(String[] args) throws Exception{
// TODO Auto-generated method stub
String message = "Junk characters? method sendMultipartTextMessage only send text message. If you want to send non text message, you should look to method sendDataMessage. Below is the code excerpt from android cts. It has example on how to send long messages.";
String phone = "92***********";
String username = "abcd";
String password = "1234";
String address = "http://192.168.1.101";
String port = "8090";
URL url = new URL(
address+":"+port+"/SendSMS?username="+username+"&password="+password+
"&phone="+phone+"&message="+URLEncoder.encode(message,"UTF-8"));
URLConnection connection = url.openConnection();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
while((inputLine = bufferedReader.readLine()) !=null){
System.out.println(inputLine);
}
bufferedReader.close();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With