ADF Mobile enables you to create an application that can house different types of content that runs on mobile devices powered by Apple iOS platforms or Android devices. This section of the tutorial walks you through configuring your environment so that you can develop and test ADF Mobile applications using JDeveloper and an Android environment. In this section you configure build and test small application using the Android environment and emulator. Although we are configuring the environment to use an emulator, you can also deploy to an actual Android device.

The images below show you what your simulator will look like when you successfully complete the tutorial.

hello world app in simulator hello world app in simulator
Step 1: Download and Install the Required Components
  1. Download and install the Android SDK from http://developer.android.com/sdk/index.html.

    check for updates

  2. Unzip the adt-bundle-windows-x86_64.zip in a folder of your choice, for example AndroidSDK.

  3. Find and double-click the SDK Manager.exe application. The Android SDK Manager is invoked. The Manager is what is used to install all the packages and emulators you use.

  4. By default, the Android SDK Tools, Android SDK Platform-tools and several other packages are installed. You also need to install the Google Cloud Messaging for Android Library. To see this option you must select the Obsolete checkbox at the bottom of the window.

    Then, scroll toward the bottom of the SDK Manager, select the Google Cloud Messaging for Android Library and click Install.


    check for updates

  5. You will need to have installed JDeveloper version 11.1.2.4 or later. You can download JDeveloper from the Oracle ADF Mobile page. Click the Downloads tab to see the JDeveloper download.

  6. Install the ADF Mobile extension by using the JDeveloper Update Center. Start JDeveloper, and then select the menu item Help - Check for Updates.

    check for updates

  7. Click Next at the Welcome dialog.

  8. Select the Search Update Center radio button and click Next.

  9. step 1 in check for updates
  10. Enter mobile in the Available Updates: search box and select the ADF Mobile extension, then click Next

  11. step 1 in check for updates

  12. Accept the licensing agreements. Click Next and the download will start. Once complete, click Finish.

    step 2 in check for updates

  13. Restart JDeveloper as instructed.

    restart jdevloper message

  14. When JDeveloper is restarted, select Studio Developer (All Features) to be able to use the ADF Mobile extension.

    After JDeveloper is restarted, set the device SDK preferences as follows:

  15. Select the menu item Tools > Preferences.

    preferences menu
  16. On the left side of the Preferences screen, click the ADF Mobile node. If you are using the ADF Mobile extension for the first time you may need to click the Load Extension button.

    mobile preferences

  17. Next, expand the ADF Mobile node, and select Platforms. In the Supported Platforms list box, ensure Android is selected.

  18. Update all entries with the correct directory locations. If you have installed the SDK to its default location, then you can click on the magnifying glass next to the input list, and navigate to the Android SDK Directory as recommended in the image or your installation location. Do the same for the Android Platform Location and Android Build Tools Location (even though it's greyed out, you can still use the magnifying glass to find the correct location).

    There is a default password for the debug Key and Keystore. You can ignore those values for now.

    platform sdk location
  19. Click OK to dismiss the Preferences pane.

  20. Reopen the Android SDK Manager and create and start an Android emulator to use for your mobile deployment.

    check for updates

  21. In the Android SDK Manager menu bar, select Tools - Manage AVDs...

    The Android Virtual Device Manager dialog is displayed.

    check for updates

  22. Click the New button and specify the following values to the properties.

    check for updates

    AVD Name = ADFmf
    Device = Nexus One
    Target = Android 4.2 - API Level 17
    Internal Storage = 500 MiB
    SD Card
    = 500 MiB
    Back Camera = Emulated
    Memory Options Ram = 768

  23. For the remainder, keep the defaults and click the OK button.

    You may choose another device type, keeping in mind that newer devices have greater resource demands and you may run into RAM issues on your own machine.

    check for updates

  24. A notification of the new AVD is displayed. Click OK to dismiss it.

    check for updates

  25. Select the new AVD and click the Start button.

    check for updates

  26. Accept the default values in the Launch Options pane, and click Launch.

  27. check for updates

  28. It may take a while for the emulator to be invoked and start running. Depending on the speed of your CPU, 2 minutes is possible. Once it's running, you may continue and test your mobile deployment.

    check for updates

Step 2: Create an ADF Mobile Application

    In this part of the tutorial, you create and deploy a “Hello World” ADF Mobile application to the Android emulator. Preparing ADF Mobile Framework applications for deployment is primarily comprised of creating platform-specific deployment profiles.
    A deployment profile defines how an application is packaged into the archive that will be deployed to either an iOS or Android platform.
    The deployment profile:
    - Specifies the format and contents of the archive.
    - Lists the source files, deployment descriptors, and other auxiliary files that will be packaged into the archive file.
    - Describes the type and name of the archive file to be created.
    - Highlights dependency information, platform-specific instructions, and other information.

  1. In the Application Navigator click New Application to start the New Gallery dialog box.

    New Application
  2. In the New Gallery expand the General - Applications nodes and select Mobile Application (ADF) and click OK.

    new gallery mobile application item


  3. In the Name your application page, enter MyMobileApp in the Application Name field, and click Next.

    name mobile application

  4. Click Next, and examine the Project Features for your second project, ApplicationController. The project includes the ADF Mobile Framework.

    features of application controller  project
  5. Click Next twice and in the Name your project page, leave the default project name. Examine the Project Features for the ViewController project. Notice that the project uses ADF Mobile Framework, HTML and CSS, Java, and JavaScript project features.

    project features in view controller project

  6. Click Next and Finish. In the Application Navigator, all the files associated with a new ADF Mobile application are viewable.

    application navigator files after mobile app creation

    After you complete an ADF Mobile Framework application, JDeveloper adds both project and application level artifacts. Among these artifacts is an ADF Mobile framework model project and the view-controller project (with the default name, ViewController) that has the ADF Mobile framework feature application resources. These resources include the configuration file for applications features, adfmf-feature.xml. The configuration file is a stub XML descriptor file that enables you to define feature applications that will be seen when the application runs. The adfmf-feature.xml defines details of each feature - for example, its icon, content type, starting point, etc.

    The adfmf-application.xml file defines the details of the application itself, including reference to features. These feature applications, when packaged into a JAR file known as a Feature Archive file (FAR), provide the reusable content that can be consumed by other ADF Mobile applications. One reason for this distinction is to allow developers to create feature archives (which may contain one or more features referenced in the adfmf-feature.xml), and then create applications by simply pulling in feature archives.  Of course each app would only have one adfmf-application.xml.

    A FAR is essentially a self-contained collection of everything that a feature requires, such as icon images, resource bundles, HTML, JavaScript, or other implementation-specific files. The FAR includes a single adfmf-feature.xml file, which identifies each of the packaged feature applications by a unique ID. You can edit this file to update feature properties. For example, you can specify the content implementation (local or remote HTML files, AMX pages, or a native application written in platform-specific language). You can also control the display of content based on such factors as user roles and privileges, or device properties. A mobile application can reference one FAR, several of them, or none at all.

  7. Right-click on the ViewController project and select New
    In the New Gallery, select Web Tier - HTML and then the HTML Page item. Click OK.

    application navigator files after mobile app creation

  8. Accept the default File Name and Directory, then click OK.

    application navigator files after mobile app creation

  9. In the Editor, type the following text "Deployment Successful". Highlight the text and in the visual editor toolbar, select the fourth drop down list from the left, select 7. It might seem large, but it will appear smaller when running in the emulator.

  10. Save your work.


  11. application navigator files after mobile app creation


Step 3: Add UI Access to the Pages

    In this section, you configure a new feature so the user can access the newly defined local HTML page from the native application container. You will need to perform this task whenever you add pages or task flows to your application.

  1. In the Application Navigator, expand the ViewController project. Locate and expand the Application Sources folder. Then expand the META-INF folder. You will see the adfmf-feature.xml file as shown.

    adfmf-feature,xml selected in the applications navigator

  2. Double click on the adfmf-feature.xml file to open the Feature editor.

    adfmf-feature.xml in editor

  3. Add a new feature by clicking the green plus sign on the Features table near top of the editor. If you cannot see the plus sign, scroll the Feature editor to the right (the plus sign is on the far right side of the Feature editor).

    adfmf-feature.xml with create adf mobile feature pane displayed with default values

  4. In the Create ADF Mobile Feature dialog, modify the following values:

    - Feature Name: Success
    - Feature ID: oracle.success

    Accept the default directory value, and confirm the Add a corresponding feature reference to adfmf-application.xml check box is selected, and then click OK.

    adfmf-feature.xml with create adf mobile feature pane displayed with correct values

  5. In the Features table, select the newly created feature oracle.success. Under the Features table, click the Content tab, and locate the Content table. Notice that the content item oracle.success.1 is created by default.

  6. Save your work.


  7. adfmf-feature.xml with content tab displayed with correct values

  8. In the Content area, set the Type property is set to Local HTML.

    content tab with correct type displayed

  9. In the Content section, find the URL text box.

    On the right side of the URL text box, click the magnifying glass icon.

    task flow selected when green plus sign is clicked

  10. In the Open window, select the html page you created earlier. In this case, untitled1.html. Then click Open.

    view controller rask flow option selected in content tab

  11. The resulting definition should look like the image below.

    completed feature displayed in the editor

  12. Save all your work.


Step 4: Deploy and Test the Page in an Android Emulator

    Now that you have an environment installed and have created an application, you're ready to deploy the application to the emulator.

  1. Confirm your emulator is still running. At the bottom of the emulator, click the Applications icon and all the installed applications will be visible.

  2. Keep the emulator open and return to JDeveloper and the MyMobileApp application.

    check for updates

  3. In the Application menu, select Deploy - New Deployment Profile to start the Create Deployment Profile dialog box.

    deploy - new deployment profile menu option

  4. In the Profile Type drop-down list, ensure ADF Mobile for Android is selected. Enter Android_Mobile_Native_archive1 as the Deployment Profile Name and click OK.

    name of deployment profile

  5. Select the Android Options node and confirm your values look like the ones below.

    setting simulator target version to 5.0

  6. Click OK, and then save all your work.

  7. In the Application menu, select Deploy > Android_Mobile_Native_archive….

    deploy menu option

  8. In the subsequent dialog box, select Deploy application to emulator, and click Finish.

  9. deploy profile to simulator window

  10. Watch the Deployment Log window for any errors. If the compilation and deployment process completes as expected, you should see the Deployment Log window as shown below.

    deployment log window - deployment finished

  11. Navigate back to the emulator. Click the Home button...

    application in iOS simulator

    ...and then the Application icon to refresh the applications.

    application in iOS simulator

    You should see the MyMobileApp application you have just created and deployed.

  12. Click the MyMobileApp icon to start the application.

  13. application in iOS simulator

    The MyMobileApp application currently contains your HTML page running inside the ADF Mobile application.
    hello world application in simulator

  14. If you are finished, then close the emulator, but remember to restart it before you want to deploy to it again.

Back to top
Copyright © 2011, Oracle. All rights reserved.