Solved

Sending sms through java programming and j2me

Posted on 2006-06-18
7
453 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Checkbox and ListView in Android Layout 4 65
servlet filter example 37 58
use lov values 2 49
Running JavaFX on JDeveloper 12C 1 31
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…
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

806 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