Solved

Sending sms through java programming and j2me

Posted on 2006-06-18
7
457 Views
Last Modified: 2007-12-19
dear helper
i want to send the sms using java and also j2me .please help me in this regard and if you have tutorial for that or source code for that please provide me for learning purpos.


thanks
regards
softflux
0
Comment
Question by:softflux
7 Comments
 
LVL 6

Accepted Solution

by:
phuocnh earned 25 total points
ID: 16932820
I am using SMSLib http://smslib.org 
Phuoc
0
 
LVL 3

Assisted Solution

by:Kanti
Kanti earned 25 total points
ID: 16933245
see http://www.dreamfabric.com/sms/

SMProLib tool - sending SMS via Java. You also can receive messages.
http://mobiles.unipro.ru/smlib_eng.html


You need a phone that supports Wireless Messaging API (WMA) as part of the J2ME implementation. Both WMA 1.1 and 2.0 are out.

You  can find some API's of few model of phones
 http://www.sms-gateway-software.com


This code is from a Motorola SDK document for WMA 2.0:


//To send SMS
try {
String addr = “sms://+358401234567”;
MessageConnection conn = (MessageConnection) Connector.open(addr);
TextMessage msg =
(TextMessage)conn.newMessage(MessageConnection.TEXT_MESSAGE);
msg.setPayloadText(“Hello World!”);
conn.send(msg);
} catch (Exception e) {
...
}




//To receive SMS
try {
String addr = “sms://:5432”;
MessageConnection conn = (MessageConnection) Connector.open(addr);
Message msg = null;
while (someExitCondition) {
// wait for incoming messages
msg = conn.receive();
// received a message
if (msg instanceof TextMessage) {
TextMessage tmsg = (TextMessage)msg;
String receivedText = tmsg.getPayloadText();
// respond with the same text with “Received:”
// inserted in the beginning
tmsg.setPayloadText(“Received:” + receivedText);
// Note that the recipient address in the message is
// already correct as we are reusing the same object
conn.send(tmsg);
} else {
// Received message was not a text message, but e.g. binary
...
}
}
} catch (Exception e) {
...
}

0
 
LVL 35

Assisted Solution

by:girionis
girionis earned 25 total points
ID: 16933269
An alternative solution to using a phone is to use an SMS server to send a message. It is actually *very easy* once you have access to the SMS server since they are several protocols you could use such as HTTP, WML, TCP/IP, SMTP and probably several others (it depends on the sms server vendor). Once you register with an SMS vendor they provide you with a username/password pair which you should use in all your requests to the server in order to identify them.

I have done it twice in the past and I have used clickatell: http://www.clickatell.com/ for this, very easy to use and very low prices (depends on the volume of SMS you want to send though).
0
 
LVL 30

Assisted Solution

by:Mayank S
Mayank S earned 25 total points
ID: 16933582
0
 
LVL 2

Assisted Solution

by:RoyalNepal
RoyalNepal earned 25 total points
ID: 16938413
Hey,
   Which Wireless Tool Kit do you have?????? If you have WTK 2.3 there is a project example for that. I think there is one in WTK 2.2 as well.
Go to src folder in that project and see the code.

Hope that helps.

Roy

0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
simple java question 3 59
How to convert String matching to regex in java 4 48
ejb on wildfly 5 30
Chrome and Firefox Java 5 49
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question