Sunday, April 22, 2007

JAVA 認證心得 -- SCMAD (11)

Wireless Messaging API 1.1 (WMA)

##CONTINUE##

  • CBS (Cell Broadcast Service) can only be received by an application and cannot be sent. If the send() method is called with a CBS address, IOException will be thrown.
  • WMA provides separate permissions for SMS and CBS protocol.
  • Messages can be received asynchronously by creating a class implementing the MessageListener interface and registering an instance of the class to the connection using the MessageConnection.setMessageListener()
  • TextMessage.setPayloadText(String msg)
  • BinaryMesage.setPayloadData(byte[] byte)
  • Messages are delivered to the application in the same order as the device received them.
  • When a large message is spilt into multiple SMS messages, ordering is handled correctly when they are automatically concatenated back into a single Message object.
  • MessageConnection.numberOfSegments(Message msg)
  • An application can have several MessageConnection instances open simultaneously and these connections can be both in client and server mode.
  • Message.getTimeStamp method always returns null for received cell broadcast.
  • A text message can be sent by passing either the constant MessageConnection.TEXT_MESSAGE or the value “text” in the MessageConnection.newMessage(String Type) method. Same as MessageConnection.BINARY_MESSAGE / “binary”
  • The Message length of an SMS depends on two factors
    • Encoding used, such as GSM 7-bit alphabet, and UCS-2 16 bit
    • Presence/absence of port number


  • An IllegalArgumentException would be thrown if the message is sent using a MessageConnection that is different from the MessageConnection which was used to create the message using the newMessage() method. If a timeout occurs an InterruptedIOException is thrown.
  • A message can be received either

    Ø Synchronously: Using MessageConnection.receive() blocking method

    Ø Asynchronously: By creating a class implementing the MessageListener interface and registering an instance of the class to the connection using the MessageConnection.setMessageListener() method.

  • The MessageListener interface has a notifyIncomingMessage() method, which would be called when a message arrives. The listener mechanism allows applications to receive incoming messages without needing to have a thread blocked in the receive() method call. If multiple messages arrive very closely together in time, the implementation has the option of calling this listener from multiple threads in parallel. Applications MUST be prepared to handle this and implement any necessary synchronization as part of the application code, while obeying the requirements set for the listener method.
  • The GSM standard specifies two mechanisms for SMS message concatenation.
  • The system property wireless.messaging.sms.smsc contains the SMSC address.

Read more!

No comments: