This tutorial walks you through the process of developing an on-device ADF Mobile application using JDeveloper. In this tutorial, you deploy the application to an iPhone simulator. However, the developed application can also be deployed to an actual iOS device.

If you are interested in the setup and deployment to an Android emulator start with Part 2: Setup and Configure an Android Environment.

show more or less

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. In this tutorial we'll work with an iOS simulator. Within the framework of the application, the contained content areas are referred to as features and represent a specific piece of the application’s functionality. End users can access features from either the navigation bar or the springboard on the iOS devices. The icons that represent the application features can be grouped together by functionality and aligned by permissions, as well as implementation considerations.

The following types of application features can coexist within the same ADF Mobile application:
- Local ADF Mobile XML file—although you are not required to develop the application features that reside within the ADF Mobile application, this implementation approach allows you to define an application feature that utilizes many of the device's functionality through embedded components, with the metadata represented by an XML file. This application feature implementation, which is generated into HTML or JavaScript on a mobile device and which uses ADF data bindings, is developed declaratively using a set of ADF Mobile-specific components in JDeveloper.
- Local HTML files or remote URL—this implementation approach allows you to employ an HTML file that embeds existing technologies, such as JavaScript and Java. Or you can simply point to a resource on the Web by specifying a URL end point. You can use JDeveloper to implement this type of feature.

An ADF Mobile application enables integration of its features with such native device utilities as phone, camera, GPS, and so on. You can define the contract for accessing and controlling each feature, as well as supply constraints to determine the display of a feature at run time (such as, for example, Role, OS, Version). The mobile device utilities can be accessed from the local HTML, local ADF Mobile XML, Java, and remote Web applications.

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

hello world app in simulator hello world app in simulator

Step 1: Download and Install the Required Components
  1. Get access to a Mac that is running operating system 10.8 (Mountain Lion) or above.

  2. Download and install XCode version 5.x, (included with this version of Xcode is iOS7 and SDK. It is recommended that you remove any older versions of the Xcode and only have the 5.x version installed on your machine.

    The Xcode and iOS SDK are available from Apple. Show more or lessRead more...

    You can purchase/download Xcode and iOS SDK from the Apple App Store for Mac, or by participating in the iOS Developer Program. The download includes the Xcode IDE, Instruments, iOS Simulator, and the latest iOS SDK. You can compile and test the application with just Xcode and iOS SDK, but you must participate in the iOS Developer program if you want to deploy the application to an actual device. It is necessary when Xcode has just been installed for the first time to run it at least once as per section 3.4.2 in the ADF Mobile guide otherwise users will hit error code 69.

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

    check for updates

  4. Click the Next button to search the update centers. Make sure Oracle Fusion Middleware Products is selected and click Next.

    step 1 in check for updates

  5. To install ADF Mobile extension for the first time, select the ADF Mobile check box.
    Then click Next.

    step 1 in check for updates

    Accept the license agreement, and then click Next.

    step 1 in check for updates

    The download will automatically start.

    step 1 in check for updates

  6. When it's complete, click Finish.

  7. Restart JDeveloper as instructed.

    restart jdevloper message

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

    Next, you need to set preferences in JDeveloper to use the SDK provided by XCode 5.

    Select the menu item Tools > Preferences.

    preferences menu

  9. 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, click the Load Extension button.

    mobile preferences

  10. Next, expand the ADF Mobile node, and select Platforms.
    In the Supported Platform list box, ensure iOS is selected.

    Update all entries with the correct directory locations. If you have installed Xcode to its default location, then you can click on the magnifying glass next to the input list, and navigate to a similar iOS SDK Directory as recommended in the hint. Since we installed XCode 5, the iPhoneSimulatorSDK is 7.0.

    The remaining iTunes property should be set to the default install location. If not, then set it.

    platform sdk location

    Click OK to dismiss the Preferences pane.

Step 2: Create an ADF Mobile Application
  1. In this part, you first create a “Hello World” ADF Mobile application, and then deploy this starter application to the iPhone simulator.

    Preparing ADF Mobile Framework applications for deployment is primarily comprised of creating platform-specific deployment profiles. Show more or lessRead more...

    A deployment profile defines how an application is packaged into the archive that will be deployed to either an iOS device or emulator. 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.

    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).
    Then 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. You should see a new ADF Mobile application created in JDeveloper.

    application navigator files after mobile app creation

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

    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".

    Then, highlight the text and then in a fourth drop down from the left, select 7. It might seem large, but it will appear smaller when running in the simulator.

    Save all your work.

    application navigator files after mobile app creation

Step 3: Add UI Access to the Pages
  1. In this section, you configure a new feature so the user can access the newly defined AMX pages from the native application container. You will need to perform this task when ever you add pages or task flows to your application.

    After you complete an ADF Mobile Framework application project, JDeveloper adds both project and application level artifacts.Show more or lessRead more...

    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.This file is configured with a default application, Hello, that you ran earlier.

    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.

    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 launch 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:

    - Name: Success
    - Feature ID: oracle.success
    - 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.

    Save your work.

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

  6. Confirm the Id field of the content item is set to oracle.success.1.

    content tab with correct id displayed

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

    content tab with correct type displayed

  8. 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

  9. 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

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

    Save all your work.

    completed feature displayed in the editor

Step 4: Deploy and Test the Page
  1. In the Application menu, select Deploy - New Deployment Profile to start the Create Deployment Profile dialog box.

    There are three other predefined deployment profiles you can use. One for an default iOS deployment, another for a default Android deployment. The third type is used to create a mobile application archive. THis archive includes everything, files, icons, reference links but not any signing certificates. It would be used if you wanted to transport an application and install and deploy it using with different credentials.

    For our purposes, lets examine what we get when we go through the whole process.

    deploy - new deployment profile menu option

  2. In the Profile Type drop-down list, ensure ADF Mobile for iOS is selected and then click OK. Leave the Profile Name at it's default value.

    name of deployment profile

  3. In the ADF Mobile for iOS Deployment Profile Properties dialog box, examine the deployment options.

    deployment profile properties

  4. Select the iOS Options node and confirm the Simulator Target Version is set to 7.0.3.

    setting simulator target version to 5.0

    Click OK, and then save all your work.

  5. Before deploying the application, confirm the iOS Simulator is working correctly by clicking on the icon on the desktop. Once it has started, you can leave it alone.

    deploy menu option

  6. In the Application menu, select Deploy > iOS2 deployment profile.

    deploy menu option

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

    deploy profile to simulator window

    There are two approaches to testing an ADF Mobile application: Show more or lessRead more...

    1. Testing on a mobile device: This method always provides the most accurate behavior, and is also necessary to gauge the performance of your application. However, you may not have access to all the devices on which you wish to test, making device testing impractical.

    2. Testing on a mobile device emulator or simulator: This method usually offers better performance and faster deployment, as well as convenience. However, even though a device emulator or simulator closely approximates the corresponding physical device, there might be differences in behavior and limitations on the capabilities that can be emulated.

    Typically, a combination of both approaches yields the best results.

  7. 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.

    The next step in the process is to start the iOS Simulator.

    deployment log window - deployment finished

  8. After the simulator is started, use your mouse to swipe from right to left exposing a second page of applications in the iPhone simulator. You should see the MyMobileApp application we have just created and deployed.

    application in iOS simulator

    Click the MyMobileApp icon to start the application.

    application in iOS simulator

  9. The MyMobileApp application currently contains your HTML page running inside the ADF Mobile application. Because there is only one feature in the application currently, you'll only see one feature.

    hello world application in simulator

  10. To clear out the application from the simulator, select iOS Simulator - Reset Content and Settings... from the menu. Then click Reset to confirm.

    quit ios simulator menu option

    To clear the settings, click OK in this pane.

    quit ios simulator menu option

  11. Shut down the iPhone simulator by clicking the iOS Simulator menu item (on the top of the Mac desktop), and selecting Quit iOS Simulator.

    quit ios simulator menu option

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