Question

I'm using WMADemo of the JavaME SDK 3.0 and it's working fine in simulator.

When I install the application in a mobile device it doesn't work. I tried both port 0 (default SMS) and 50000 (listener) with no success. No exception was thrown.

Was it helpful?

Solution

This is an example that works for me

try {
        String dest = "sms://" + yourRecipientNumberString;
        MessageConnection mConn = (MessageConnection) Connector.open(dest);
        TextMessage sms = (TextMessage) mConn.newMessage(MessageConnection.TEXT_MESSAGE);
        sms.setPayloadText(msgText);
        mConn.send(sms);
        mConn.close();
    sent = true;
} catch (IOException ioe) {
    ioe.printStackTrace();
    sent = false;
} catch (IllegalArgumentException iae) {
    iae.printStackTrace();
    sent = false;
} catch (SecurityException se) {
    se.printStackTrace();
    sent = false;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top