3 Configuring the Content of a MAF Application

This chapter describes using the MAF Application Editor and MAF Features Editor to define the display behavior of the mobile application's springboard and navigation bar and how to designate content by embedding application features.

This chapter includes the following sections:

3.1 Introduction to Defining Mobile Applications

A mobile application can have one or more view controller-type projects, each of which describes a set of features in an maf-feature.xml file. As described in Chapter 2, "Getting Started with MAF Application Development," MAF provides you with the maf-application.xml configuration file for the mobile application itself, and the maf-feature.xml file, which you use to define the content of the application. While you can manually change these files, MAF provides two editors that enable you to build these files declaratively:

  • the MAF Application Editor, which provides a declarative interface for editing the maf-application.xml file; and

  • the Mobile Feature Editor, which provides a declarative interface for editing the maf-feature.xml file.

3.1.1 About the MAF Application Editor

The MAF Application Editor enables you to configure the maf-application.xml file to set the basic configuration of the mobile application by designating its display name, a unique application ID (to prevent naming collisions) and also by selecting the application features that will display on the application springboard (the equivalent of a home page on a smartphone). Further, this editor enables you to create the user preferences pages for the mobile application. The editor is described in Section 2.2, "Creating a MAF Application,".

Figure 3-1 Application Features Displaying in the Mobile Application's Springboard

This image is described in the surrounding text

You can modify these elements declaratively using the MAF Application Editor, shown in Figure 3-2, or manually using the XML Editor or the Source editor. You can use these approaches interchangeably.

Figure 3-2 The MAF Application Editor for the maf-application.xml File

This image is described in the surrounding text

3.1.2 About the Mobile Feature Editor

The MAF Feature Editor enables you to add features to your application. You create the features with this editor, and specify the characteristics (ID, name, description, vendor information, version, lifecycle event listener, security, and images for navigation and for the springboard) through the editor.

3.2 Using the Oracle MAF Perspective

In Eclipse, a perspective is a collection of views arranged in a specific layout that is suitable for a type of development. MAF has its own perspective which you should use when you are developing MAF applications. It gives you access to menu and toolbar options that we describe elsewhere in this manual.

To change to the Oracle MAF perspective:

  1. In the IDE, click Window > Open Perspective > Other.

    Alternatively, click This image is described in the surrounding text.

  2. In the Open Perspectives dialog, choose Oracle MAF. Click OK.

3.3 How to Define the Basic Information for an Application Feature

The MAF Application Editor enables you to set the name, application ID, and how the mobile application displays. You can also enter vendor and version information, select or create a lifecycle event listener.

To access the MAF Application Editor:

  • From the Project Explorer, expand the assembly project folder, then expand the MAF folder and double-click MAF Application Editor.

3.4 How to Set the ID and Display Behavior for a Mobile Application

The Application page of the MAF Application Editor, shown in Figure 3-3, enables you to name the mobile application and control the display of the mobile application within the springboard and navigation bar.

Before you begin:

Open the MAF Application Editor by double-clicking MAF Application Editor (located in the MAF node of the assembly project in the Project Explorer panel, as shown in Figure 3-3).

Figure 3-3 Selecting MAF Application Editor in the Project Explorer

This image is described in the surrounding text

To set the basic information for a mobile application:

  1. Choose the Application page by selecting the application's name in the Outline.

    Note:

    By default, the editor opens the Application page.

    Figure 3-4 shows the portion of the application page where you define the basic information.

    Figure 3-4 Setting the Basic Information for the Mobile Application

    This image is described in the surrounding text
  2. Enter a display name for the application in the Name field. This attribute can be localized. For more information, see Section 7.1, "Introduction to MAF Application Localization."

    Note:

    MAF uses the value entered in this field as the name for the iOS archive (.ipa or .app) file that it creates when you deploy the application to an iOS-powered device or simulator. For more information, see Section 28.4.1, "How to Create an iOS Deployment Configuration."
  3. Accept the default, or enter a unique ID in the Id field.

    To avoid naming collisions, Android and iOS use reverse package names, such as com.company.application. OEPE prefixes com.company as a reverse package to the application name, but you can overwrite this value with another as long as it is unique and adheres to the ID guidelines for both iOS- and Android-powered devices. For iOS application, see the "Creating and Configuring App IDs" section in iOS Team Administration Guide (available from the iOS Developer Library at http://developer.apple.com/library/ios). For Android, refer to the document entitled "The AndroidManifest.xml File," which is available from the Android Developers website (http://developer.android.com/guide/topics/manifest/manifest-intro.html). You can overwrite this ID in the deployment profiles described in Section 28.3.1, "How to Create an Android Deployment Configuration" and Section 28.4.1, "How to Create an iOS Deployment Configuration."

    Note:

    To ensure that an application deploys successfully to an Android-powered device or emulator, the ID must begin with a letter, not with a number or a period. For example, an ID comprised of a wholly numeric value, such as 925090 (com.company.925090) will prevent the application from deploying. An ID that begins with letters, such as hello925090 (com.company.hello925090) will enable the deployment to succeed.
  4. Enter a short, but detailed summary of the application that describes the application's purpose in the Description field.

  5. Enter the version in the Version field.

  6. Enter the name of the vendor who originated this application in the Vendor field.

  7. Click Browse next to the Lifecycle Event Listener field to invoke the Edit Property dialog, shown in Figure 3-5, to register the event listener that enables runtime calls for start, stop, activate, and deactivate events. You must enter the fully qualified class name of the event listener. This is an optional field.

    Note:

    If you place the mouse pointer over the label for Lifecycle Event Listener, OEPE displays a tooltip describing the listener class.

    Figure 3-5 Retrieving the Application Event Listener

    This image is described in the surrounding text

    The default application listener class is application.LifeCycleListenerImpl. MAF does not register this class by default, because it starts the JVM and therefore may not be preferable for each mobile application. You must instead register this class manually using the Select Class dialog, shown in Figure 3-5. After you close this dialog, OEPE updates the <adfmf:application> element with a listener-class attribute, as illustrated in the example below of adding the listener-class Attribute.

    Note:

    The application lifecycle listener must remain within the application controller project (its default location).
    <adfmf:application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                       xmlns:adfmf="http://xmlns.oracle.com/adf/mf"
                       name="OracleMobileApplication"
                       id="com.company.OracleMobileApplication"
                       appControllerFolder="ApplicationController" 
                       listener-class="application.LifeCycleListenerImpl"
                       version="1.1"
                       vendor="Oracle">
       <adfmf:description>This is a mobile application</adfmf:description>
       <adfmf:featureReference id="feature1"/>
    </adfmf:application>
    

    For more information, see Section 11.1, "About Using Lifecycle Event Listeners in MAF Applications."