I am making an app in which i am have to send sms to another number using internet
but i donot want to use phone native api i.e.smsManage
r means i donot want to pay for sms to mobile operator That means. i want to use Internet
to send messages.like twillo
and nexmo
but iam unable to use this api in my android app. if iam using this api in my android the application is crashing so if any api is there please suggest me. or any other references are there to send sms through internet
. or by using webservices
Asked
Active
Viewed 1.1k times
2

user2918549
- 33
- 1
- 1
- 3
-
possible duplicate of [Programmatic SMS](http://stackoverflow.com/questions/4269/programmatic-sms) – Dan Hulme Oct 25 '13 at 19:59
1 Answers
2
The term you are looking is SMS gateway
.. Twilio API is working well with android, or you can use some other as per your wish..
Best is Bulk SMS. First Register here and then use your user name and password as shown in the example
Example:
import java.net.*;
import java.io.*;
public class SendSms {
static public void main(String[] args) {
try {
// Construct data
String data = "";
data += "username=" + URLEncoder.encode("your username", "ISO-8859-1");
data += "&password=" + URLEncoder.encode("password", "ISO-8859-1");
data += "&message=" + URLEncoder.encode("your message", "ISO-8859-1");
data += "&want_report=1";
data += "&msisdn=44123123123";// relace with the number
// Send data
URL url = new URL("http://bulksms.vsms.net:5567/eapi/submission/send_sms/2/2.0");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();
// Get the response
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = rd.readLine()) != null) {
// Print the response output...
System.out.println(line);
}
wr.close();
rd.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}

Linga
- 10,379
- 10
- 52
- 104
-
do you have any tutorial for that or sample program. for send sms through twilio in android. – user2918549 Oct 25 '13 at 11:16
-
you can download it from twilio itself. they give java api. you can use it – Linga Oct 25 '13 at 11:20
-
1
-
i changed following link https://gist.github.com/kwhinnery/5254045. program according to my requirement. it worked well in normal java program. but android it crashed – user2918549 Oct 25 '13 at 11:26
-
-
-
Thanks. I will check. Because i registered But not got any activation code – user2918549 Oct 25 '13 at 12:23