Hi All

How i can send SMS by Java Mobile Application.
I want the Class which used.
Thanx

Osama

Recommended Answers

All 5 Replies

SMS triggered bombs? And asking others to write the software for them?
What'll Al Qaeda think up next...

There are a great many SMS libraries out there for you to purchase (and some may even have a limited functionality free version).
As you obviously didn't even bother researching the subject or you'd have found those yourself you should first do that.

hi
try it with this peace of code

 MessageConnection smsconn = null;
 smsconn = (MessageConnection) Connector.open(address);       String address = "sms://" + phoneNumberField.getString() + ":50000";     // address for sending sms "sms://phno:portno"
        MessageConnection smsconn = null;
        try {
            smsconn = (MessageConnection) Connector.open(address);

            TextMessage txtmessage = (TextMessage)smsconn.newMessage(MessageConnection.TEXT_MESSAGE);
            txtmessage.setAddress(address);
            txtmessage.setPayloadText(messageField.getString());
            smsconn.send(txtmessage);

thanks and regards
thiyagu.

Hi All

How i can send SMS by Java Mobile Application.
I want the Class which used.
Thanx

Osama

Hi jwenting,
Always you are scolding the forum senders. what you think about you man. See if you know the solution for the query, just send it otherwise shut your mouth. Don't give false replies.
otherwise show a good way to solve the problem by themselves.

Don't take it as advice its a humble request.


Share the knowledge don't show your anger...

Hidash..

String phone="123456789";
String message="Hello India,";
String ppgHost= "http://localhost:portno";
try
{
phone=URLEncoder.encode(getMobileId(), "UTF-8");
if(debug)
System.out.println("phone---->"+phone);
message=URLEncoder.encode(getMessage(), "UTF-8");
if(debug)
System.out.println("message---->"+message);
}
catch (UnsupportedEncodingException e)
{
System.out.println("Encoding not supported");
}
String url_str=ppgHost+"?PhoneNumber="+phone+"&Text="+message;


System.out.println("path name---url_str----->\n\n"+url_str);
URL url2=new URL(url_str);
HttpURLConnection connection = (HttpURLConnection) url2.openConnection();
connection.setDoOutput(false);
connection.setDoInput(true);
if(debug)
System.out.println("connection :"+connection);
String res=connection.getResponseMessage();
if(debug)
System.out.println("res :"+res);


int code = connection.getResponseCode () ;
if ( code == HttpURLConnection.HTTP_OK )
{


connection.disconnect() ;


}
System.out.println("Message Sent Successfully");
commented: Useless solution for a dead thread and no code tags even after 83 posts -1

All that for a three year dead thread?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.