|Oracle® Database Mobile Server Mobile Client Guide
Part Number E22681-02
|PDF · Mobi · ePub|
Note:This chapter assumes that you know how to use Eclipse to build an Android project and how to appropriately develop and sign an Android application.
Install the Mobile Development Kit.
Import the Oracle Database Mobile Server
simple_sync_android sample Android project into your Eclipse Workspace.
In Eclipse, with your Workspace open, select File->Import and choose Existing Projects into Workspace. Click Next.
Set the root directory to point to the Android project within the Oracle Database Mobile Server MDK. Enable the Select Root Directory button and browse for the
simple_sync_android project, which is located in the following directory:
<MDK_ROOT> is replaced with the full path where the Oracle Database Mobile Server MDK is installed.
Figure 4-2 demonstrates setting the root directory. After which, all projects in the specified root directory are displayed in the Projects window.
simple_sync_android project and click Finish. The
simple_sync_android project is now imported into your Eclipse Workspace.
Set required environment variables. The project references Oracle Database Mobile Server synchronization classes, which are located within the
osync_android.jar library file. Set the
MOBILE_SYNC_ANDROID_LIB environment variable to point to
osync_android.jar file with the following steps:
simple_sync_android project in the Project Explorer window, as shown in Figure 4-3.
Select 'Alt Enter' to display the Project Properties window.
As shown in Figure 4-4, select the Java Build Path in the left pane. Then, select the Libraries tab in the Build Path window. Select
MOBILE_SYNC_ANDROID_LIB to configure the location of the JAR file. The
MOBILE_SYNC_ANDROID_LIB variable provides the library directory where the
osync_android.jar file is located, which is required to build your project. Click Edit.
In the "Edit Variable Entry" dialog, click the Variable button.
/Mobile/Sdk/android/lib/osync_android.jar in the Path field.
When finished, click OK.
In the "Classpath Variables Changed" dialog, select Yes to rebuild the project.
simple_sync_android project to link in the
osync_android.jar file with the Oracle Database Mobile Server synchronization libraries.
Execute and debug the
simple_sync_android project with the Android emulator.
Right click on the
Click Run As and select Android Application.
The Android emulator is started, where you can execute the sample as the Mobile Sync application.
When you execute the Mobile Sync application, synchronization is initiated. Enter your user name, password and mobile server URL in the Sync UI, as shown in Figure 4-11. Click Sync to start the synchronization.
MainAct.java code. The sample consists of the UI layout code that is located in the
res\layout subdirectory. The main application Java class file is
MainAct.java, which contains all of the logic for initializing synchronization structures and invoking the synchronization methods. You can examine this file for more details on the sequence of calls for the synchronization APIs.