back to j2megame.org

Nokia SMS API v0.9 (draft)

This API provides SMS send and receive functions to Java applications in some Nokia phones supporting the MIDP Java platform.

See:
          Description

Packages
com.nokia.mid.messaging Sending and receiving messages As usual with the Generic Connection Framework, the message sending and receiving functionality is implemented by a Connection interface, in this case MessageConnection.

 

This API provides SMS send and receive functions to Java applications in some Nokia phones supporting the MIDP Java platform.

Note: The JSR120 Wireless Messaging API specification under development within the Java Community Process will cover these same functions. This Nokia specific API is only for use in products prior to the JSR120 being finished. Once the JSR120 is finished, it will be implemented in future products of Nokia instead of this Nokia specific API.

Overview

The API is based on the Generic Connection Framework (javax.microedition.io package) that is used for I/O and networking functionality in the J2ME profiles. The framework has been originally specified in the Connected Limited Device Configuration specification.

Representation of message

A message is represented by a class that implements interface(s) defined for the messages in the API.

The base interface that is implemented by all messages is named Message. It provides methods that are common for all messages, i.e. primarily addressing.

The API is designed to handle messages that are text based as well as binary messages. These are represented by two subinterfaces of Message: TextMessage and BinaryMessage. These provide ways to manipulate the payload of the message as Java Strings and byte arrays, respectively.

It is possible to define other subinterfaces of Message for other kinds of message payloads than pure text or pure binary. Naturally it is also possible to create further subinterfaces of TextMessage and BinaryMessage for possible protocol specific features.

Sending and receiving messages

As usual with the Generic Connection Framework, the message sending and receiving functionality is implemented by a Connection interface, in this case MessageConnection.

The application obtains an object implementing the MessageConnection from the Connector class by providing a URL like string that identifies the address.

If the application specifies an full address that defines a recipient to the Connector, it gets a MessageConnection that works in a 'client' mode. This kind of Connection can only be used for sending messages to the address specified when creating it.

The application can create a 'server' mode MessageConnection by providing a URL string that includes only an identifier that specifies the messages intended to be received by this application. Then it can use this MessageConnection object for receiving and sending messages.

The URL strings that identify the addresses are specific to the messaging protocol used.

The MessageConnection object provides also factory methods for creating Message objects for sending.

For receiving messages, the MessageConnection supports also an event listener based receive mechanism, in addition to synchronous blocking receive() method.

Note that the methods for sending and receiving messages may throw a SecurityException. This is thrown if the application does not have the permission for those operations. It is out of the scope for this specification how the permissions are determined and this is left implementation specific and/or to be defined by other specifications.


forum.nokia.com/java

Copyright (c) 2002 Nokia Mobile Phones. All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc.