Tuesday, October 26, 2010

Sms Sending

You can send sms using j2me code by following code

String address = "sms://" + destinationAddress;
       
        MessageConnection smsconn = null;
        try {
            /** Open the message connection. */
            smsconn = (MessageConnection)Connector.open(address);
           
            TextMessage txtmessage = (TextMessage)smsconn.newMessage(MessageConnection.TEXT_MESSAGE);
            txtmessage.setPayloadText(destinationMessage);
            smsconn.send(txtmessage);
           
        }
        catch(Exception e) {
            e.printStackTrace();
        }

1 comment:

  1. Thanks mihir,

    I found this code very useful to send me sms for my application .

    But whenever i send sms it ask for conformation so user must need interaction with application but i want to send sms without user interaction at some time interval . Is there any solution to send sms without that conformation.

    ReplyDelete