This article provides a simple code example (and downloadable sample Midlet) for sending an SMS using Java ME. The process of sending an SMS is fairly simple, and should be easily implemented by even beginners. The article shows how sending an sms comprises the following steps: 1. Opening a new Message connection consisting of "sms://" followed by the intended recipient's phone number. 2. Creating the TextMessage object. 3. Setting the "payload text" of the message (the contents of the message). 4. Sending the message using the MessageConnection object. 5. Closing the MessageConnection.
The example shows clearly how to send an SMS using Java ME. It also points out possible problems - such as exceeding the maximum allowed length and the need to send messages using a separate thread to ensure that interaction can continue.
--Larry101 12:15, 19 September 2009 (UTC)