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);
          // prepares text message
          TextMessage msg = (TextMessage)conn.newMessage(MessageConnection.TEXT_MESSAGE);
          //set text
          // send message
        } 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.