Motorola C550, C450, C370 technical manual StartApp or the pauseApp

Page 27

5

Application Management

 

pauseApp()

AMS, MIDlet

The pauseApp() method is called from either AMS or

 

 

 

from within the MIDlet.

 

 

 

The pauseApp() should pause active threads, and

 

 

 

prepare for startApp() to be called.

 

 

 

If the application is to be resumed with a screen other than

 

 

 

the present, then the Displayable should be set current in

 

 

 

the startApp() or the pauseApp().

 

destroyApp()

AMS

The destroyApp() method is called from AMS and

 

 

 

signals the MIDlet to clean up any resources to prepare for

 

 

 

termination. For example, open RMS records should be

 

 

 

closed, threads should be stopped, and any other

 

 

 

housekeeping chores should be performed.

 

 

 

The MIDlet should not call destroyApp().

 

 

 

 

 

notifyDestroy

MIDlet

The notifyDestroyed() method is called by the

 

ed()

 

MIDlet to exit and terminate itself.

 

 

 

All housekeeping such as stopping active threads and

 

 

 

closing RMS records should be performed before calling

 

 

 

notifyDestroyed().

 

 

 

notifyDestroyed() notifies AMS to terminate the

 

 

 

calling MIDlet.

 

 

 

 

On a device without a windowing system, only one application can have focus at a time. When an application has focus, it receives keypad input, and has access to the display, speakers, LED lights, vibrator, etc. The C370, C450, and C550 device can only run one MIDlet at a time, but that MIDlet has to share focus with the system user interface. That user interface is a higher priority than the MIDlet, so the MIDlet will immediately lose focus when the system needs to handle a phone call or some other interrupt.

The concept of focus correlates directly with the MIDlet state. i.e. when a MIDlet loses focus because of a phone call, the MIDlet is immediately paused. Conversely to the example of starting the MIDlet, the MIDlet loses focus immediately, then its pauseApp() method is called.

The paused state is not clearly defined by MIDP. The only requirement placed on the device manufacturer is that a paused 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. Essentially, a paused MIDlet is a MIDlet without focus whose pauseApp() method has been called. It’s up to the developer to control their threads, such as making them sleep for longer periods, completely pausing game threads, or terminating threads that can be restarted when the MIDlet is made active again.

Similarly, a MIDlet’s focus is also lost immediately before its destroyApp() method is called.

The MIDlet must be written properly (as described above) to implement all methods in the javax.microedition.midlet package, especially startApp( ) and pauseApp( ). A

27

Image 27
Contents Technical Manual Table of Contents Lcdui JAD Attributes Disclaimer IntroductionPurpose AudienceReferences Acronym Description Revision HistoryDefinitions, Abbreviations, Acronyms Date Name ReasonDocument Overview Introduction Java 2 Platform, Micro Edition J2ME J2ME IntroductionResources Available Motorola J2ME PlatformJava VM Description DisplayNetworking File & RMSDeveloping and Packaging J2ME Applications Guide to Development in J2MEIntroduction to Development Page OTA Procedure InstallationDownloading Applications Program and Data space notes Java Application Installer/De-Installer Jaid Starting ApplicationsExiting Applications Error Checks Launching Web Session for Http DownloadDownloading MIDlets XML Screen Renderings BombMan is back, now on your Taichi series of handsets Taichi handset New Games MIDlet Lifecycle Application ManagementMIDlet Suite Installation MIDlet Suite De-installation DestroyApp MIDlet Suite UpdatingCaller Purpose MethodStartApp or the pauseApp Using startApp MIDlet Control of MIDlet State Transitions Java SystemPage Network Connections Network APIClass Descriptions URL Format IOException when it detects a time-out conditionTCP Sockets UDP SocketsImplementation Notes Network API Description LcduiLcdui Gaming API and Sound Functional DescriptionClass Hierarchy Gaming API containing a sound API Using BackgroundMusicBackgroundMusic Class BackgroundMusic MethodsGameScreen Fields GameScreen ClassPublic int getKeyStates GameScreen MethodsInformation, disabling key events can improve performance GameScreen Using GameScreenImageUtil Class ImageUtil FieldsImageUtil Methods RgbData Using ImageUtilPalleteImage Class PalleteImage ConstructorPalleteImage Methods Public void setTransparentIndexint index throws Using PalleteImagePlayField Class Using Static and Animated TilesUsing Sprites Defining View WindowsPlayField Constructor 2N+1 2N + Public void addSpriteSprite s throws PlayField MethodsPage Public boolean collidesWithAnyTileSprite s throws PlayField Using PlayFieldSoundEffect Methods Using SoundEffectSoundEffect Class Sprite ClassAnimation Frames Sprite DrawingSprite Constructor Sprite Methods Page Public final void drawGraphics g throws Using Sprite FileFormatNotSupportedExceptionSprites Java Gaming Sound API Java Gaming Sound APIMax Midi Extension Support FileFormatNotSupportedException ConstructorsVibe and Backlight API Vibe and BacklightCreating a Message OverviewPermissions Sending a MessageJAD Attributes JAD AttributesMandatory attributes for manifest files MIDlet-Name RecordStore Record Management SystemClass Description Code ExamplesCaveats TipsPhonebook Access API Phonebook AccessSample of code to create object of PhoneBookRecord class Phonebook Access API PermissionsSimmemory Sample of code for calling of ‘getMaxEmailLength ’ method Sample of code for calling of ‘isPrimaryint speedNo’ method Sample of code for calling of ‘getNumberCategories’ method Sample of code for calling of ‘setCategoryView’ method Sample of code for calling of ‘getUsedRecords’ method Int index = ReceivedRecord.getRecord1 Intelligent Keypad Text Entry API ITAPKey Mapping for the C370, C450, and C550 Appendix a Key MappingCenter Select END Available Memory Appendix B Memory Management CalculationAppendix C Online FAQC370, C450, and C550 Spec Sheets Appendix D Spec SheetsMotorola Developer Information Tools DocumentationReferences Purchase Motorola Developer Information Tools Motorola, Inc
Related manuals
Manual 110 pages 1.04 Kb