Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Midlet SMS from Moto V3

I am having a problem that I just plain can't figure out with SMS. I am using the code below on a Moto Razor V3 phone CLDC-1.0, MIDP-2.0. I am having problems with permissions.

I've tried 2 ways.

1) Not adding anything to the permissions API and letting the phone prompt me
2) Adding the "javax.microedition.io.Connector.sms" to the API permissions.

Either way fails. Here's what happens:
1) App is always installed (OTA) fine.
2) I am able to connect using the HttpConnection class and I am correctly prompted by the phone for permission authorization.
3) I am never able to successfully use the MessageConnection class. I am never prompted to authorize. It simply throws the following error: "javax.microedition.sms was denied"

What a, I doing wrong?

package hello;

import javax.microedition.io.Connector;
import javax.microedition.io.HttpConnection;
import javax.wireless.messaging.MessageConnection;
import javax.wireless.messaging.TextMessage;

public class SMSConnector{

public static void sendSMS() throws Exception{
MessageConnection clientConn = null;
HttpConnection msgCon = null;

// not the number I am using. I am using my cell phone number
// this is just the format of the number I am using
String smsAddr = "sms://18605551212";

// This works fine. I am prompted by the phone to authorize
// this access attempt as I would expect
msgCon = (HttpConnection)Connector.open("http://www.sun.com");

// This fails. I am not asked to authorize the attempt
// I simply get a
clientConn = (MessageConnection)Connector.open(smsAddr);

}
}
[1850 byte] By [Delware] at [2007-11-11 7:51:26]
# 1 Re: Midlet SMS from Moto V3
Can you try to run the code on an emulator first and see what happens with respect to that class? i.e., which operations take place before the class is enabled? It's certainly an authorizations/permissions issue but I can't be more specific than that.
Danny at 2007-11-12 0:15:40 >
# 2 Re: Midlet SMS from Moto V3
Hi Danny,

When I run it in the emulator, I get the expected security prompt also. I am asked if I would like to allow the app to connect to the network as I would expect it to. It just doesn't do that on either phone (Moto V3, Moto V551)

Thanks
John
Delware at 2007-11-12 0:16:34 >
# 3 Re: Midlet SMS from Moto V3
It's a pretty common scenario, and in most cases it boils down to installing certain certificates or reconfiguring the target device. I can't be more specific than this since I'm not familiar with these models but try to look for the the FAQ on the manufacturer's developers' Web site. It should be one of the top 10 questions;)
Danny at 2007-11-12 0:17:43 >