You Are Here:

Community: Wiki

This page was last modified on 16 July 2009, at 12:50.

WMA 1.0 (JSR-120)

From Forum Nokia Wiki

The Wireless Messaging API (WMA) provides a common interface you can use to enable an application based on the Mobile Information Device Profile (MIDP) to send and receive short text and binary messages, as well as multimedia messages. These messages typically are part of store-and-forward messaging systems such as the Short Messaging Service (SMS) and the Multimedia Messaging Service (MMS) that guarantee delivery of messages.

All WMA-specific interfaces and classes are contained in a single package, javax.wireless.messaging, which defines all the APIs required for sending and receiving wireless text, binary, and multi-part messages.

Interface Summary

BinaryMessage

An interface representing a binary message.

Message

This is the base interface for derived interfaces that represent various types of messages.

MessageConnection

The MessageConnection interface defines the basic functionality for sending and receiving messages.

MessageListener

The MessageListener interface provides a mechanism for the application to be notified of incoming messages.

TextMessage

An interface representing a text message.

Sending SMS Code Snippet:

MessageConnection con = (MessageConnection)Connector.open(address);
TextMessage txtmsg =(TextMessage) con.newMessage(MessageConnection.TEXT_MESSAGE);
txtmsg.setPayloadText(smsmsg);
txtmsg.setAddress(address);
con.send(txtmsg);

Receiving SMS Using Push Registry:

// This is registered to the port number 1111
// Should implement MessageListener.
try{
PushRegistry.registerConnection("sms://:1111",this.getClass().getName(),"*");
}catch(Exception e){}
String[] connList;
connList = PushRegistry.listConnections(true);
if((connList == null) || (connList.length == 0))
{
destroyApp(true);.l/
notifyDestroyed();
}
else {
try{
msgconn = (MessageConnection)Connector.open("sms://:1111");
msgconn.setMessageListener(this);
} catch(IOException e){ e.printStackTrace();}
 
public void notifyIncomingMessage(MessageConnection conn)
{
try{
TextMessage txtmsg = (TextMessage)msgconn.receive();
}catch(Exception e){System.out.println(e);}
String newmsg = txtmsg.getPayloadText();
String msgaddr = txtmsg.getAddress();
}
}

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fTalkE3aE4cargeE5fscreenE5fsaverX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ