Code:
public boolean sendSms(String number, String message){
        boolean result = true;
        try {
          //sets address to send message
          String addr = "sms://"+number;
          // opens connection
          MessageConnection conn = (MessageConnection) Connector.open(addr);
          // prepares text message
          TextMessage msg = (TextMessage)conn.newMessage(MessageConnection.TEXT_MESSAGE);
          //set text
          msg.setPayloadText(message);
          // send message
          conn.send(msg);
          conn.close();
        } catch (SecurityException se) {
            // probably the user has not allowed to send sms
            // you may want to handle this differently
            result = false;
        } catch (Exception e) {
            result = false;
        }
        return result;
    }
Hi guys,
this is what I use in my application to send SMS. It does work but it odes not always return TRUE. Where do you think might me the error?
Thank you.