scmad chapter10

14
By Marcel Caraciolo http://mobideia.blogspot.com Chapter 10– Wireless Messaging API SCMAD Certification 45mm 61mm

Upload: marcel-caraciolo

Post on 25-May-2015

1.299 views

Category:

Technology


0 download

DESCRIPTION

Chapter 10 - SCMAD Study Guide. WMA . Only for studies purposes.

TRANSCRIPT

Page 1: Scmad Chapter10

By Marcel Caraciolo

http://mobideia.blogspot.com

Chapter 10– Wireless Messaging API

SCMAD Certification 45mm

61m

m

Page 2: Scmad Chapter10

Agenda•WMA•Wireless Messaging API•Messaging Connector•Message Types•Classes•Permissions

Page 3: Scmad Chapter10

WM WMA – Wireless Messaging API

•API for sending and receiving mobile phone messages (SMS, MMS, etc.)•Defined over GCF•Similar to datagram, but uses different API:

javax.microedition.messaging•Messages may be:•Text Message (sends String though SMS messages)•Binary Message (sends byte arrays over SMS messages)•MultipartMessage (MMS, only available at WMA 2.0)

•Message infrastructures usually are “store-and-forward” : if the destination device is not available when the message is sent, it may be delivered later.

Page 4: Scmad Chapter10

WM WMA – Wireless Messaging API

•Messages are composed of:•An address (may be destination or origin address, according to the context)•A TimeStamp from when it was sent•“Payload” itself

•It’s a protocol-independent API, but has the same QOS of the protocol•Sending a message is usually billed, so this must be considered when designing the application•Like any network operation, messages must be sent and received on a separate thread

Page 5: Scmad Chapter10

M Message Connection

•Extends Connection: Although very similar to datagrams , SMS messages are not considered datagrams•Created using Connector.open(“sms://[phoneNumber]:[:port]”)•If no port is informed, the message will be sent to the device’s inbox. If it’s informed, it’s sent to an application waiting on that port. It’s impossible to access or intercept messages sent to the inbox•Trying to open streams (e.g. Connector.openOutputStream()) with WMA protocols throws an exception since these protocols are not stream-oriented

Page 6: Scmad Chapter10

M Message Connection

•There are “client” and “server” connections:•Client : “sms: //12345678:1234” Can only send messages to this number•Server: “sms://:1234” Can send messages to any number and also receive messages. Server connections must always inform a port number.

Page 7: Scmad Chapter10

M Message Connection

•MessageConnection object works as:•Factory Method for creating messages (newMessage(type),

newMessage(type, address))•Sending messages•Receiving messages•Calculating how many segments a message will consume (a message may be larger than the maximum size supported by the protocol. In this case several messages are sent and re-organized by the receiver)•MessageListener may be registered to notify message arrivals

Page 8: Scmad Chapter10

M Message Types

•SMS (Short message service):•Supports 140 bytes payload. The number of character per message depends on the encoding:• 7 Bits: 160 characters• 8 Bits: 140 characters•16 Bits: 70 characters

•WMA allows sending messages bigger than allowed by the protocol (sending several messages (segments)). Devices must support messages with at least 3 segments (420 bytes).

Page 9: Scmad Chapter10

M Message Types

•CBS(Cell broadcast service):•Messages may only be received (broadcast). You cannot open CBS connections in “client” mode or send CBS messages

Page 10: Scmad Chapter10

M WMA: Class Diagram

Page 11: Scmad Chapter10

WMA: Permissions

•javax.microedition.io.Connector.sms•javax.microedition.io.Connector.cbs•javax.microedition.io.Connector.mms•javax.wireless.messaging.sms.send•javax.wireless.messaging.sms.receive•javax.wireless.messaging.cbs.receive

Page 12: Scmad Chapter10

Example Codes

• Some examples and MIDlets samples are available for reference and studying at this link:•http://www.dsc.upe.br/~mpc/chapter10.rar

•The source codes include:•SMSMIDlet

Page 13: Scmad Chapter10

Future Work

• Next Chapter:

• MIDP - Deployment• MIDlet Suites• JAD Descriptor• OTA Provisioning

•MIDP – Push Registry•Push Registry•Static Registry•PushRegistry

Page 14: Scmad Chapter10

References

• ALVES F. Eduardo. SCMAD Study Guide, 27/04/2008.

• JAKL Andreas, Java Platform, Micro Edition Part 01 slides, 12/2007.

• Sun Certification Mobile Application Developer Website: [http://www.sun.com/training/certification/java/scmad.xml].