Community: Wiki

你在这里: You Are Here: Olet tässä: Vous êtes ici: Sie befinden sich hier: Tu sei qui: 現在のページ: Você está aqui: Вы здесь: Usted está aquí:
This page was last modified 02:06, 4 July 2008.

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);
		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();
	   	}
		}

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditFurlTechnocratiMagnoliaTwitter  Share this page Share this page Invite a friend Invite a friend
E-mail Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us Regional websites: Chinese Japanese © 2008 Nokia 
RDF Facets: qfnZtopicQUqfnTopicZjavaQ qfnZtypeQUqfnTypeZCommunityContentQ qfnZtypeQUqfnTypeZWebpageQ qfnZtypeQUqfnTypeZWikiContentQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX