Disclaimer Motorola reserves the right to make changes without notice to any products or services described herein. “Typical” parameters, which may be provided in Motorola Data sheets and/or specifications can and do vary in different applications and actual performance may vary.
In no event shall Motorola be liable, whether in contract or tort (including negligence), for any damages resulting form use of a product or service described herein, or for any indirect, incidental, special or consequential damages of any kind, or loss of revenue or...
J2ME Java 2 Micro Edition JSR 120 Java Specification Request 120 defines a set of optional APIs that provides standard access to wireless communication resources. Java Virtual Machine KJava Virtual Machine Licensee Close Classes Lightweight Window Toolkit Motorola Developers Program...
MIDP Mobile Information Device Profile Original Equipment Manufacturer Over The Air Record Management System RTOS Real Time Operating System Service Center Software Development Kit Short Message Service Subscribe Unit User Interface Location Services Unified Resource Identifier Virtual Machine Document Overview This developer’s guide is organized into the following chapters and appendixes: Chapter 1 –...
Page 9
Appendix A – Key Mapping for the C370, C450, and C550 series of handsets: this appendix describes the key mapping of the Motorola C370, C450, and C550 series of handsets, including key name, key code, and game action of all Motorola keys.
J2ME Introduction The C370, C450, and C550 series of handsets includes the Java™ 2 Platform, Micro Edition, also known as the J2ME platform. The J2ME platform enables developers to easily create a variety of Java applications ranging from business applications to games. Prior to its inclusion, services or applications residing on small consumer devices like cell phones could not be upgraded or added to without significant effort.
For more information on J2ME, see the Sun™ J2ME documentation (http://java.sun.com/j2me/). The Motorola J2ME Platform Functionality not covered by the CLDC and MIDP APIs is left for individual OEMs to implement and support. By adding to the standard APIs, manufacturers can allow developers to access and take advantage of the unique functionality of their series of handsetss.
Page 12
Description Resource Display Resolution 96 x 64 Color Depth 12 bit color (4096 colors) Networking Max HTTP, UDP and TCP Socket connections* 4 with any combinations File & RMS Max number of Files/RMS* Java VM Heap Size 512 KB Program Space 1.2 MB Max Resource Space* 450 KB...
MIDlets for J2ME series of handsetss. There is a wealth of material on this subject on websites maintained by Motorola, Sun Microsystems and others. Please refer to the following URLs for more information: http://www.motocoder.com...
Page 14
These IDEs come from a range of sources such as Sun, IBM, Metrowerks and Borland to name a few. In addition to the IDEs and Sun SDK for development, Motorola offers access to our own SDK which contains Motorola device emulators. From here, a MIDlet can be built and then deployed onto an emulated target series of handsets.
The application developer should follow the WAP server site instructions to download the MIDlet properly. After loading the JAR and JAD file on the Motorola C370, C450, and C550 series of handsets, the friendly name specified in the MANIFEST.MF file for the MIDlets should appear on the Games &...
Page 16
• No more than ~500 files are used by installed MIDlet suites. • JAR size listed in JAD matches actual JAR size. • MIDlet suite name and MIDlet vendor are 32 bytes max • MIDlet suite version must be higher than an already installed one. Even though the Data and Program Space in Java System indicate more available space than the size of a particular JAR file, it doesn't necessarily mean the JAR will install.
Data space. The original JAR file is then destroyed. Applications only need to be JAID installed once. If the Motorola C370, C450, and C550 series of handsets’s software is upgraded, Java applications must be re-installed.
Mot-Program-Space-Requirements attributes are added to the JAD of the MIDlet, a Motorola series of handsets can determine if enough memory exists on the phone before the MIDlet is downloaded. These attributes may or may not be provided in all MIDlets.
Downloading Applications application being downloaded with the version on the series of handsets. One of the following instances will occur: • Same version exists – user is prompted with a dialog stating application already exists and is prompted to cancel or read details of the download. •...
Page 20
> <file name="Digital Clock" href="clock.jar" type="jar" size="10000" vendor="Motorola" version="1.0" date="20010101" adf="DESC.jad" > This is a digital clock running on your series of handsets. </file> <file name="Bouncing Ball" href="bounce.jar" type="jar" size="6000" vendor="Sun" version="1.0" date="20010101" adf="Bounce.jad" > An example illustrating a bouncing ball on your screen.
Page 21
Downloading Applications Example: Taichi handset. New Games This is a directory full of games • <a> The text between the open and close of the <a> tag will be rendered as hyperlink on the page. Example: This is a directory full of games Next page SELECT...
Application Management MIDlet Lifecycle A MIDlet’s lifecycle begins once its MIDlet Suite is downloaded to the device. From that point, the Application Management Software (AMS) manages the MIDlet Suite and its MIDlets. The user’s primary user interface for the AMS is the Java Apps feature built into the device’s firmware.
Application Management • MIDlet Suite Version • The number of MIDlets in the MIDlet Suite • The Data Space (MIDlet suite resources). • Program Space (Unpacked JAR) Note: This image reflects a 176 x 220 display for document readability purposes only. The C370, C450, and C550 maintain a 96 x 64 display.
Note: This image reflects a 176 x 220 display for document readability purposes only. The C370, C450, and C550 maintain a 96 x 64 display. Additionally, the items that may appear on the actual device may differ from those displayed in the image above MIDlet Suite De-installation An installed MIDlet can only be removed from the device by de-installing it from the Java Apps menu.
Application Management MIDlet Suite Updating When a MIDlet Suite is de-installed, all of its resources are removed including any resources that were created by the MIDlets in the suite, such as RMS databases. If a user gets a new version of a MIDlet Suite, then the user can simply download that new version to the device that has the older version installed.
Page 26
initializing state variables and preparing to be run in its constructor or startApp() methods, it may appear to be stalled to users. The flow below depicts MIDlet State Transitions. Starting Starting Application Application Constructor Constructor startApp() startApp() Running Running Paused Paused Application Application...
Page 27
MIDlet must be able to respond to network events and timer events. On Motorola devices, the paused state simply implies that the MIDlet is in the background as mentioned above, but it doesn’t force any of the threads to stop execution.
Page 28
common error is to implement startApp( ) to execute instructions that are only intended to be executed once during MIDlet execution. The correct implementation is to include in startApp( ) those instructions which can and should be executed each time the MIDlet changes from the Paused state to the Active state.
Application Management MIDlet Control of MIDlet State Transitions MIDlets have a lot of flexibility to control their own state. A MIDlet can call its own startApp(), pauseApp(), and destroyApp() methods, however those are the methods that the AMS uses to indicate a state transition to the MIDlet. The MIDlet can call those methods if it wishes to perform the work that it would typically do during that state transition.
Page 30
Note: This image reflects a 176 x 220 display for document readability purposes only. The C370, C450, and C550 maintain a 96 x 64 display.
Network API Network Connections The J2ME platform on the Motorola C370, C450, and C550 series of handsets provides a variety of networking functionalities beyond those specified in MIDP. The additional networking protocols are added through the Generic Connection Interface in order to simplify the interface to the application as well as to reduce the need for additional classes.
Class Descriptions <<Interface>> <<Interface>> StreamConnectionNotifier DatagramConnection <<Interface>> Connection <<Interface>> <<Inte rface>> InputConnection OutputConnection <<Interface>> StreamConnection <<Interface>> Content Co nnection <<Interface>> HttpConnection Since all the additional communication protocols have been added to the Generic Connection Framework, the access methods and parameters are very similar. The main calls are to the class, which provides three static methods that accept Connector...
- boolean timeout – IOException when it detects a time-out condition. The time-out period for the TCP implementation on the Motorola C370, C450, and C550 series of handsets is 20 seconds on read operation and about 45 seconds on write operation if the time-out flag is set to true.
1472 bytes and 2944 bytes, respectively. Implementation Notes As stated in the previous sections, the Motorola C370, C450, and C550 series of handsets supports some networking options. The networking options however are limited by both memory and bandwidth, which place hard restrictions on the applications. These limitations manifest themselves mainly in the number of simultaneous connections that can be opened.
OutputStream Connection be completely closed. An application in the paused state can still continue to actively use the networking facilities of the Motorola C370, C450, and C550 series of handsets. The platform does not support simultaneous voice and data transmissions.
LCDUI LCDUI API The following table lists the specific interfaces supported by Motorola implementation: Interface Description Choice Choice defines an API for user interface components implementing selection from a predefined number of choices. CommandListener This interface is used by applications which need to receive high-level...
Page 37
LCDUI information of an action. CustomItem A CustemItem is customizable by sub classing to introduce new visual and interactive elements into Forms. DateField A DateField is an editable component for presenting date and time (calendar) information that will be placed into a Form. Display Display represents the manager of the display and input devices of the system.
Class Hierarchy The following diagram shows the Gaming API hierarchy. javax.microedition.lcdui javax.microedition.lcdui com.motorola.game com.motorola.game Graphics Graphics GameScreen GameScreen SoundEffect...
BackgroundMusic bgm2 = BackgroundMusic.createBackgroundMusic("http://www.motorola.com/sounds/JazzyTunes.mid"); The following code sample shows implementation of the Gaming API that contains a sound API: Gaming API containing a sound API import com.motorola.game.*; public class GS extends GameScreen { public BackgroundMusic bgm; public GS() bgm = BackgroundMusic.createBackgroundMusic("vinovata.mid");...
GameScreen Class class provides the basis for a game user interface. In addition to the GameScreen features inherited from MIDP's Canvas (commands, input events, etc.) The GameScreen class provides game-specific capabilities such as an off-screen buffer with synchronized flushing and key status polling. A game can provide its own thread to run the game loop. A typical loop will check for input, implement the game logic, and then render the updated user interface.
Gaming API and Sound • - The minimum volume for public static final int VOLUME_MIN playing sound effects. This constant has a value of 0. GameScreen Methods class defines the following methods: GameScreen • - Obtains the Graphics object for protected Graphics getGraphics() rendering GameScreens.
Page 42
information, disabling key events can improve performance. Note that this setting is unique to each GameScreen instance; other GameScreens, when shown, are subject to their own setting for key events. • public void paint(javax.microedition.lcdui.Graphics g) Paints this GameScreen. By default, this method does nothing. It can be overridden according to application needs.
Gaming API and Sound • public void playBackgroundMusic (BackgroundMusic bgm, - Plays the specified BackgroundMusic object from the beginning. boolean loop) This method first stops the current BackgroundMusic if any. Thus, this method may be used to start background music (by specifying a non-null BackgroundMusic object), restart the current background music (by specifying the same BackgroundMusic object), change the background music, or end the background music (by specifying null).
ImageUtil Class provides static methods useful to the manipulation of objects. ImageUtil Image Specifically, it provides methods for setting and getting RGB values, and also provides the ability to create a scaled instance of an existing Image ImageUtil Fields class defines the following fields: ImageUtil •...
Gaming API and Sound 24-bit color format (0xRRGGBB). The method parameters are the following: dest The mutable destination Image whose pixels will be set; - The horizontal location of left edge of the region; - The vertical location of the top edge of the region; width - The width of the region;...
PalleteImage Class provides methods for manipulating the color palette data of an image. PaletteImage can only be created with palette-based image data (PNG color type 3, PaletteImages or other palette image formats that a particular device may support). A single palette entry or the entire palette can be retrieved as a series of RGB values in 0xRRGGBB format (MIDP color format).
Gaming API and Sound • public void setTransparentIndex(int index) throws – Sets the current transparent index. Pixels IndexOutOfBoundsException that reference the transparent index in the palette are not drawn when the image is rendered. The effects of the new transparent index will be reflected in the next Image object that is created by calling getImage().
raceCar.setPaletteEntry(0, 0x0000FF); Image blueRaceCar = raceCar.getImage(); // Set the car color to green and retrieve the Image raceCar.setPaletteEntry(0, 0x00FF00); Image greenRaceCar = raceCar.getImage(); // The PaletteImage can now be discarded since we have the // Image objects that we need raceCar = null;...
Gaming API and Sound calling , cells (0,0) and (0,1) will then be drawn setAnimatedTileImage(-2, 2); with the image of static Tile 2. Using Sprites In addition to being a grid of cells, a can have a set of associated Playfield Sprites (see 0 item).
Page 50
multiple of the tile width. The height of the source image must be an integer multiple of the tile height. The tiles in the source image will have indices as follows: The static tiles are indexed like words are read on a page; left-to-right, then top-to- bottom.
Gaming API and Sound PlayField are all empty (tile 0 - a reserved tile and represents an empty square). A tile set can later be added using setStaticTileSet(). PlayField Methods class defines the following methods: PlayField • public void addSprite(Sprite s) throws NullPointerException –...
Page 52
source and destination cells overlap, the method shall behave as if the source cells are first copied to a separate array, the source cells are cleared, and the tiles are then copied back to the destination cells. The method parameters are the following: - column of top-left destination cell;...
Page 53
Gaming API and Sound collidesWithAnyTile(Sprite) and collidesWithTiles(int, int, int, int, Sprite, boolean) complement each other. Sprite does not have to have been added to the PlayField. The collision detection will proceed as if the Sprite is on the PlayField. That is, its location will be treated as relative to the origin of the PlayField's coordinate system.
• public void setViewWindow(int x, int y, int width, int height) – Sets the portion of the PlayField that will be drawn when draw(Graphics, int, int) is called. This will limit the portion of the PlayField that is drawn to the rectangle defined by the region (x, y) (x + width, y + .
// Create a SoundEffect using a wave file inside the JAR SoundEffect s1 = createSoundEffect("/jump.wav"); // Create a SoundEffect using a wave located // on a web site SoundEffect s2= createSoundEffect("http://www.motorola.com/sound/mp.wav"); }catch(FileFormatNotSupportedException fe){} Sprite Class class is used to create graphic images, animated or non-animated, that a Sprite...
Animation Frames An animated is created from an image divided into sections as described in the sprite constructor Sprite(Image, int, int). The individual sections of the image are considered the raw frames of the . The method getNumRawFrames returns the number of raw Sprite frames.
Gaming API and Sound The creation of the raw frames follows these standards: − Frames must be equally sized, all being of the frame width ( ) and height fWidth ) defined in the constructor parameters. They may be laid out in the fHeight image horizontally, vertically, or as a grid.
Page 58
• public void setDepth(int d) – Set Sprite's depth order. The depth order is relative to other Sprites when multiple Sprites are contained in a container object, i.e. a PlayField. When Sprites are drawn explicitly instead of implicitly through the use of a container object, the management of drawing order is the responsibility of the developer.
Page 59
Gaming API and Sound • public void setVisible(boolean visible) – Set visibility status. If is called, the Sprite will not be drawn by setVisible(false) until is called. draw(Graphics) setVisible(true) • public boolean isVisible() – Get visibility status. The method returns boolean indicating whether the Sprite will be drawn by draw(Graphics) •...
− Any custom frame sequence will be deleted and the frame sequence will revert to the default frame sequence for the new frame set (all frames in the frame set, left-to-right then top-to-bottom). Using Sprite The example below creates two Sprites (bullet and tank) and tests collisions between them.
BackgroundMusic class objects (from .mid resource file or from bytes array) can be played by using GameScreen.playBackgroundMusic () method. The following is a code sample to show implementation of the Java Gaming Sound API: Java Gaming Sound API import com.motorola.game.*; public class GS extends GameScreen { public BackgroundMusic bgm; public GS() bgm = BackgroundMusic.createBackgroundMusic("vinovata.mid");...
Vibe and Backlight Vibe and Backlight API The Vibe and Backlight API allows J2ME applications access to vibrator, backlight, and keypad control. This access gives a MIDlet the ability to turn on/off these features based on the application’s needs. The MIDlet will use the Vibe and Backlight API to enhance the activity being performed by the application.
SMS MO Overview Motorola has implemented certain features that are defined in the Wireless Messaging API (WMA) 1.0. The complete specification document is defined in JSR 120. The JSR 120 specification states that developers can be provided access to send (MO –...
Sending a Message The SMS MO API will provide an avenue to send a message to the appropriate SMS address. Permissions Prior to the series of handsets sending a SMS message, the series of handsets will check the SMS Access Setting under the Java Settings menu. The SMS access setting gives the user the option to perform the following: •...
MIDlet in the MIDlet Suite, but not to MIDlets outside of the MIDlet Suite. The RMS implementation of the Motorola C370, C450, and C550 series of handsets is MIDP compliant, so there are no significant additions or changes to the MIDP specification.
Caveats The maximum number of that the Motorola C370, C450, and C550 RecordStores series of handsets supports depends on the number of files installed. Once the phone has 500 RecordStores (that includes resource files, wall papers, ring tones, and other files), then it will not be able to make more.
The primary goal of the Phonebook Access API is to be simple and thin to fit in resource- limited devices like the Motorola C370, C450, and C550 series of handsets series. This API will specify a base storage class for all types of contacts items presented in the vCard specification (RFC2426 –vCard MIME Directory Profile –...
Phonebook Access API Permissions Prior to a MIDlet accessing the Phonebook API for all Phonebook operations, the implementation will check the Phonebook permissions under the Java Settings Menu. The phonebook permissions menu gives the user the following options: • Always ask the user for authorization on all Phonebook access requests •...
Page 71
Phonebook Access Sample of code for calling of ‘findRecordByName(char firstChar, int sortOrder)’ method: index = PhoneBookRecord.findRecordByName('N', PhoneBookRecord.SORT_BY_NAME); Sample of code for calling of ‘findRecordByEmail(String email, int sortOrder)’ method: String email = “email@mail.com”; index = phbkRec.findRecordByEmail(email, PhoneBookRecord.SORT_BY_NAME); Sample of code for calling of ‘getNumberRecords(int device)’ method: // get total number of records int numberRecsInPhone = PhoneBookRecord.getNumberRecords(PhoneBookRecord.PHONE_MEMORY);...
Page 72
int maxNameLengthPhone = PhoneBookRecord.getMaxNameLength(PhoneBookRecord.PHONE_MEMORY); int maxNameLengthSim = PhoneBookRecord.getMaxNameLength(PhoneBookRecord.SIM_MEMORY); int maxNameLengthAll = PhoneBookRecord.getMaxNameLength(PhoneBookRecord.ALL_MEMORY); Sample of code for calling of ‘getMaxTelNoLength (int device)’ method: int maxTelNoLengthPhone = PhoneBookRecord.getMaxTelNoLength(PhoneBookRecord.PHONE_MEMORY); int maxTelNoLengthSim = PhoneBookRecord.getMaxTelNoLength(PhoneBookRecord.SIM_MEMORY); int maxTelNoLengthAll = PhoneBookRecord.getMaxTelNoLength(PhoneBookRecord.ALL_MEMORY); Sample of code for calling of ‘getMaxEmailLength ()’ method: int maxEmailLength = PhoneBookRecord.getMaxEmailLength();...
Page 73
Phonebook Access Sample of code for calling of ‘resetPrimary(int index, int sortOrder)’ method: int index = 1; PhoneBookRecord.resetPrimary(index, PhoneBookRecord.SORT_BY_NAME); Sample of code for calling of ‘isPrimary(int speedNo)’ method: int speedNo = 1; boolean res = PhoneBookRecord.isPrimary(speedNo); Sample of code for calling of ‘fromVFormat(InputStream in, int device)’ method: buffer = new String("BEGIN:VCARD\r\nN:;"...
Page 74
int mlspeedNo = 3, mbspeedNo = 4; PhoneBookRecord.deleteMailingListMember(mlspeedNo, mbspeedNo); Sample of code for calling of ‘getMailingListMembers(int speedNo)’ method: int mlspeedNo = 3; int[] returnArray = PhoneBookRecord.getMailingListMembers(mlspeedNo); Sample of code for calling of ‘isMailingListMember(int mlSpeedNo, int mbSpeedNo)’ method: boolean returnValue = false; int mlspeedNo = 3, mbspeedNo = 4;...
Page 75
Phonebook Access int maxCategoryNameLength = PhoneBookRecord.getMaxCategoryNameLength(); Sample of code for calling of ‘getCurrentCategoryView()’ method: int categoryView = PhoneBookRecord.getCurrentCategoryView(); Sample of code for calling of ‘setCategoryView()’ method: int oldCategoryView = PhoneBookRecord.setCategoryView(categoryId); Sample of code to create object of RecentCallDialed class: String name = “Name”; String telNo = “9999999”;...
Page 76
Sample of code for calling of ‘getUsedRecords()’ method: int usedRecs = RecentCallDialed.getUsedRecords(); Sample of code for calling of ‘getNumberRecords()’ method: int numberRecs = RecentCallDialed.getNumberRecords(); Sample of code for calling of ‘getMaxNameLength()’ method: int maxNameLength = RecentCallDialed.getMaxNameLength(); Sample of code for calling of ‘getMaxTelNoLength()’ method: int maxTelNoLength = RecentCallDialed.getMaxTelNoLength();...
Page 77
Phonebook Access Sample of code for calling of ‘getRecord(int index)’ method: int index = 1; receivedRecord.getRecord(1); Sample of code for calling of ‘getUsedRecords()’ method: int usedRecs = RecentCallReceived.getUsedRecords(); Sample of code for calling of ‘getNumberRecords()’ method: int numberRecs = RecentCallReceived.getNumberRecords(); Sample of code for calling of ‘getMaxNameLength()’...
iTAP Intelligent Keypad Text Entry API When users are using features such as SMS (short message service), or “Text Messaging”, they can opt for a predictive text entry method from the series of handsets. The J2ME environment has the ability to use SMS in its API listing. The use of a predictive entry method is a compelling feature to the MIDlet.
Appendix A: Key Mapping Appendix A: Key Mapping Key Mapping for the C370, C450, and C550 The table below identifies key names and corresponding Java assignments. All other keys are not processed by Java. Assignment NUM0 NUM1 NUM2 NUM3 NUM4 SELECT, followed by NUM5 NUM6 NUM7...
Page 80
CENTER SELECT SELECT Handled according to VSCL specification: Pause/End/Resume/Background menu invoked.
Appendix B: Memory Management Calculation Appendix B: Memory Management Calculation Available Memory The available memory on the Motorola C370, C450, and C550 series of handsets is the following: • 1M shared memory for MIDlet storage • 512 Kb Heap size •...
The MOTOCODER developer program is online and able to provide access to Frequently Asked Questions around enabling technologies on Motorola products. Access to dynamic content based on questions from the Motorola J2ME developer community is available at the URL listed below.
Appendix D: Spec Sheets Appendix D: Spec Sheets C370, C450, and C550 Spec Sheets Listed below are the spec sheets for the Motorola C370, C450, and C550 handsets. The spec sheets contain information regarding the following areas: • Technical Specifications •...
Page 84
CLDC v1.0 specifications: J2ME™ SDK version v4.0 http://www.java.sun.com/products/cldc Motorola Messaging Suite v1.1 WAP forum: http://www.wap.org MMS standards: http://www.3GPP.org Documentation: Creating Media for the Motorola C370/C450/C550 Series Purchase: of Handsets Visit the Motocoder Shop at http://www.motocoder.com/ Accessories: http://www.motorola.com/consumer Motorola C550 Developer Reference Sheet...
Page 85
CodeWarrior® Wireless Studio v7.0 CLDC v1.0 specifications: J2ME™ SDK version v4.0 http://www.java.sun.com/products/cldc Motorola Messaging Suite v1.1 WAP forum: http://www.wap.org MMS standards: http://www.3GPP.org Documentation: Creating Media for the Motorola C370/C450/C550 Series Purchase: of Handsets Visit the Motocoder Shop at http://www.motocoder.com/ Accessories: http://www.motorola.com/consumer...
Page 86
MOTOROLA and the Stylized M Logo are registered in the U.S. Patent & Trademark Office. All other product or service names are the property of their respective owners. Java and all other Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.