DoJa API differs from MIDP in many ways. Further, as we've seen, DoJa
introduces a number of external technical limitations on functionality
that will require a careful porting strategy. In some cases, it may even
be necessary to significantly re-architect your application altogether. In
most cases, the workarounds involve moving local data to a server and
downloading it as required.
7.7.1 Application Lifecycle
In MIDP, the AMS calls the startApp() , pauseApp() and destroy-
App() methods of the MIDlet class in response to operating system
events or requests from the MIDlet to change its state.
In DoJa, the IApplication class that all applications must extend
simply has the resume() method for lifecycle management. There is
no pausing - an application is either running or it is suspended. You can
override the resume() method as your application requirements dictate.
When a suspended application is resumed, the operating system calls this
method as well as sending a Display.RESUME_VM_EVENT event to the
currently visible screen.
This has a direct effect on porting the pause-resume cycle used in
MIDlets. Normally on a pause event, you do tasks such as persisting
application state and releasing resources. You then code your MIDlet
so that it re-acquires these resources when the application re-starts. In
DoJa however, the application is already in the same state that it was
when it was interrupted. For example, any sound will resume playing
from its current location. Clearly, the lifecycle differences between MIDP
and DoJa applications complicate the porting process and require careful
attention and planning.
7.7.2 Local Storage
Applications that use the RMS for local persistence (particularly database-
style applications) need to be changed to use the Scratchpad which has
a maximum size of 200 KB. Apart from this size limit, there is no high-
level support for the concept of a record since the Scratchpad is a flat,
random-access file. Depending on your requirements, you may need to
work out your own method for storing, searching and updating records
which can be a fair amount of work. Alternatively, you could implement
a hybrid solution and store the data on a server and cache local data in
Many MIDlets use the RMS as a local cache for large binary assets
such as audio, video or images. If your assets are less than 200 KB, they
can be stored in the same manner as byte streams, using the Scratchpad.
If not, either reduce the size or move them to a server and pull them
down as required.