Native UltraLite for Java User's Guide
Understanding UltraLite Development
This section describes special steps that you must take to add ActiveSync to your application, and how to register your application for use with ActiveSync on your end users' machines. ActiveSync is available on Windows CE devices through the Jeode Java VM.
Synchronization requires SQL Anywhere Studio. For general information on setting up ActiveSync synchronization, see Deploying applications that use ActiveSync in the MobiLink Synchronization User's Guide. For general information on adding synchronization to an application, see Synchronizing UltraLite applications.
ActiveSync synchronization can be initiated only by ActiveSync itself. ActiveSync can automatically initiate a synchronization when the device is placed in the cradle or when the Synchronization command is selected from the ActiveSync window.
When ActiveSync initiates synchronization, the MobiLink ActiveSync provider starts the UltraLite application, if it is not already running, and sends a message to it. Your application must implement an ActiveSyncListener to receive and process messages from the MobiLink provider. Your application must specify the listener object using:
dbMgr.setActiveSyncListener( listener, "MyAppClassName" );
where MyAppClassName is a unique Windows class name for the application. For more information, see in the API Reference.
When UltraLite receives an ActiveSync message, it invokes the specified listener's activeSyncInvoked(boolean) method on a different thread. To avoid multi-threading issues, your activeSyncInvoked(boolean) method should post an event to the user interface.
If your application is multi-threaded, use a separate connection and use the Java synchronized keyword to access any objects shared with the rest of the application. The activeSyncInvoked() method should specify a StreamType.ACTIVE_SYNC for its connection's syncInfo stream and then call Connection.synchronize().
When registering your application, set the following parameters:
Class Name The same class name the application used with the Connection.setActiveSyncListener method,
Path The path to the Jeode VM (\Windows\evm.exe)
Arguments Includes the classpath (-cp
) and other Jeode command line arguments, the application name and applications arguments.
If you specify unique arguments to indicate ActiveSync activation, your application can carry out a special startup sequence knowing that it is to close upon the completion of ActiveSync synchronization.