views:

26

answers:

1

I have a midlet which sends an sms to a desired number. The midlet works fine on Nokia N70 and Nokia 6300. But while using on Samsung Champ, I am able to send an SMS only once to a certain number i.e. it works fine when sending SMS to a number but it does not work when the same or a different SMS is sent to the SAME number. It does not give any exception(s) or error(s). Here is the code I am using:

public boolean sendSMS(String contactNum, String payloadText) {
    try {
        String addr = "sms://" + contactNum;
        MessageConnection conn = (MessageConnection) Connector.open(addr);
        TextMessage msg = (TextMessage) conn.newMessage(MessageConnection.TEXT_MESSAGE);
        msg.setPayloadText(payloadText);
        if (conn.numberOfSegments(msg) == 0) {
            return false;
        }
        conn.send(msg);
    } catch (Exception e) {
        new AlertDialog("Exception", "Exception in sendSMS() occurred", "OK").show();
    }
    return true;
}

Please somebody guide me in this regard.

Thanks.

A: 

I suppose problem related to SMS port. It's not recommended to use port=0 (aka phone SMS INBOX port number). Some models even restricts usage of port #0. So try to use another port, e.g. 5000 or so. But in this case SMS won't be directed to SMS INBOX, so you have to write another midlet which will listen incoming SMS on port:5000

barmaley