Java Reference
In-Depth Information
You invoke PushRegistry.getFilter with a GCF URL to obtain a String with the filter
previously specified for the inbound connection; you might want to do this if your applica-
tion dynamically specifies its inbound end point and filter, perhaps on behalf of the user.
You invoke PushRegistry.getMidlet (note the inconsistent capitalization with many
other instances of MIDlet in the MIDP APIs) to determine the URL responsible for han-
dling a specific inbound connection.
Applying the Wireless Messaging API
Content delivery through WMA is an essential and growing part of the Java ME applica-
tion landscape. Servers can easily push information to devices asynchronously, and the
rich UI capabilities of today's Java ME handsets make for better user experience than
pushing WAP content to a wireless terminal's browser. MO messaging can play an
important role in some applications, too, such as social-networking applications or
those where a continuous network connection is too costly or too heavyweight to be
worthwhile.
In demonstrating how to use the WMA in a practical example, I chose not to extend
the WeatherWidget to receive SMS weather updates, because it would not demonstrate to
you how to originate messages using the WMA in a real application. Instead, what follows
are two simple MIDlets: one that sends and receives text SMS messages, and one that
sends and receives a picture in an MMS message.
Sending and Receiving SMS Messages
Figure 14-4 shows two instances of SMSMIDlet running in the Java ME emulator. As
you can see, the user interface is simple, consisting of one text field that permits you to
enter the destination telephone number—technically, the Mobile Station International
Subscriber Directory Number (MSISDN)—and a second text field that permits you to
enter a message.
Why two instances? One of the features of the Java ME emulator is its ability to
fully emulate the functionality the WMA provides, including sending and receiving
messages. By running two instances of the SMSMIDlet at the same time, you can test
message sending and receiving. As you see in the title bar of each emulator window,
each instance of the emulator simulates a different MSISDN (in the figure, the MSIS-
DNs +5550000 and +5550001). By using the MSISDNs of each emulator, you can test
your use of the WMA before loading your application on to actual devices. This lets you
debug your implementation on your workstation more efficiently than if you were to
debug on the target device.
 
Search WWH ::




Custom Search