Java Reference
In-Depth Information
Note WMA encompasses the concept of a port. It allows multiple applications to accept messages on the
same device. It also enables the device to differentiate between SMS messages destined for a WMA application and
standard text messages. The cost of this is a few bytes of data at the beginning of an SMS message, resulting
in only 152 characters being available for text in most cases.
You can also create a server mode connection. Instead, if you were to open the connection
using the following:
MessageConnector msgConn = (MessageConnector) Connector.open("sms:// :1234");
you would end up with a server mode connection. Typically, server mode connections are used
to receive incoming messages. However, server mode connections can actually be used to send
messages as well.
Once you have a MessageConnection , you can use it to
Create messages.
Receive messages (server mode only).
Send messages.
Obtain segmentation information on a message.
If you want to send messages, you first need to create an empty one. With an empty
message, you can then fill it up and send it. To create the empty message, you must use a
MessageConnection .
Note JTWI is a godsend for WMA standardization. JTWI 1.0 requires that a compatible device support
WMA 1.1 APIs. In particular, SMS support on GSM or WCDMA (UMTS) phones is mandated. MIDP PushRegistry
support (see Chapter 10) for incoming SMS connections is also required. If access to GSM cell broadcast is
available for Java APIs, it must be available through the WMA 1.1 APIs. Therefore, you can be right at home
with wireless messaging whenever you're working on a JTWI phone.
Creating New Messages
A MessageConnection is the class factory for messages. There is no way to create a message
other than using a MessageConnection . Figure 11-1 shows that a message is created using the
newMessage() method, which actually has two variations:
Message newMessage(String messageType);
Message newMessage(String messageType, String address);
 
Search WWH ::




Custom Search