Skip to main content

Problem with SMS Send

3 replies [Last post]
Joined: 2007-09-02
Points: 0


I really don't know if my problem is sending the message, the phone i am using or the network provider.

The scenario is:

1. I wrote a simple program to send SMS text messages.

2. I am testing the midlet in 2 phones:
* LG KG800 (Chocolate)
* Motorola Rokr E2

3. The code for the SMS sending is the following (The rest of the code is just costructing the interface for the middlet):

<br />
class SMSSender implements Runnable {<br />
		public void run () {<br />
			try {<br />
				String addr 		= "sms://+" + dest.getString();<br />
				MessageConnection conn 	= (MessageConnection);<br />
				TextMessage msg 	= (TextMessage) conn.newMessage(MessageConnection.TEXT_MESSAGE);<br />
				msg.setPayloadText(textMesg.getString() );<br />
				conn.send(msg);<br />
				conn.close();<br />
				Alert smsSend = new Alert("Send", "En mensaje se envio exitosamente\n\n" + addr, null, AlertType.INFO);<br />
				smsSend.setTimeout(Alert.FOREVER);<br />
				display.setCurrent(smsSend, mainForm);<br />
			} catch (Exception e) {<br />
				Alert exception = new Alert("Exception", "Error al enviar el mensaje\n\n" + e.getMessage() + "\n\n" + e.toString(), null, AlertType.ERROR);<br />
				exception.setTimeout(Alert.FOREVER);<br />
				display.setCurrent(exception, mainForm);<br />
			}<br />
		}<br />
	}<br />

(i put the code in a thread because if i didn't the rokr phone gave an exception about blocking activity)

4. The program runs fine in both phones. The suite is not signed because the LG software don't let me install it if i do.

5. My wireless network is 'Telcel GSM' (Mexico)

Now the problem:

The program runs in both phones, i write the phone number of the receiver, the message and click send. I get the security warning about the application trying to send a message. I accept and then i get in both phones the Alert saying the message was succesfully sent.

The problem is i never receive the message in the receivers phone.

If i understood correctly if i use the URL sms://+phoneNumber (without a port) the sms message should be sent in a client connection and be received by the normal inbox of the receivers phone.

Anyone have any idea of what could be going wrong? It could be that my wireless network? The phones? Or maybe a hit or something i misunderstood?

Thx in advance for your help!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2004-03-04
Points: 0

Yes, make sure the address is set correctly.

Also, you should make sure your code works in Wireless Toolkit (WTK). WTK has a sample code demo called "WMADemo" that demonstrates the basics of the Wireless Messaging API.

WTK also has a facility for testing SMS sending and receiving and you should use that first to make sure your code works there before moving to a phone. See WTK File->Utilities->WMA Console.

-- Terrence

Terrence Barr
Evangelist, Java Mobile & Embedded Community
Sun Microsystems, Germany

Joined: 2003-06-15
Points: 0

You need to set the send to address on the text message object.

You also need to make sure your addr has a format of "sms://+
where == your country code (for US it's 1 for UK = 44) then
is the
normal 10digit number.


Padilla, Alex D

Does anyone know how to add third party libraries into the KVM using the
Java Code Compact tool? If you know how to do so on Linux, that would
be great, but if you only know how to do so on Windows, this input would
be valuable also. Thank you all in advance.

To unsubscribe, send email to and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to and include in the body of the message "help".