开发者

Problem using J2ME WMA to send/receive SMS

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) w开发者_开发问答ith no success. No exception was thrown.


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;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜