Oracle JDeveloper 11g Tutorials android.pdf

Embed Size (px)

Citation preview

  • 8/10/2019 Oracle JDeveloper 11g Tutorials android.pdf

    1/20

  • 8/10/2019 Oracle JDeveloper 11g Tutorials android.pdf

    2/20

    Step 1: Download and Install the Required Components

    Download and install the Android SDK from http://developer.android.com/sdk/index.html .1.

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

    Find and double-click the SDK Manager.exeapplication. The Android SDK Manager is invoked. The Manager is what is used to install all the packages and emulators

    you use.

    3.

    cle JDeveloper 11g Tutorials http://docs.oracle.com/cd/E18941_01/tutorials/setupmobileapps/jdtut_...

    20 08/09/2014 09:17 p. m.

  • 8/10/2019 Oracle JDeveloper 11g Tutorials android.pdf

    3/20

    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.

    4.

    You will need to have installed JDeveloper version 11.1.2.4 or later. You can download JDeveloper from the Oracle ADF Mobilepage. Click the Downloadstab to see the

    JDeveloper download.

    5.

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

    Click Nextat the Welcome dialog.7.

    cle JDeveloper 11g Tutorials http://docs.oracle.com/cd/E18941_01/tutorials/setupmobileapps/jdtut_...

    20 08/09/2014 09:17 p. m.

  • 8/10/2019 Oracle JDeveloper 11g Tutorials android.pdf

    4/20

    Select the Search Update Centerradio button and click Next.8.

    Enter mobilein the Available Updates: search box and select the ADF Mobileextension, then click Next9.

    Accept the licensing agreements. Click Nextand the download will start. Once complete, click Finish.10.

    Restart JDeveloper as instructed.11.

    cle JDeveloper 11g Tutorials http://docs.oracle.com/cd/E18941_01/tutorials/setupmobileapps/jdtut_...

    20 08/09/2014 09:17 p. m.

  • 8/10/2019 Oracle JDeveloper 11g Tutorials android.pdf

    5/20

    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:

    12.

    Select the menu item Tools > Preferences.13.

    On the left side of the Preferences screen, click the ADF Mobilenode. If you are using the ADF Mobile extension for the first time you may need to click the Load

    Extensionbutton.

    14.

    Next, expand the ADF Mobilenode, and select Platforms. In the Supported Platforms list box, ensure Androidis selected.15.

    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.

    16.

    cle JDeveloper 11g Tutorials http://docs.oracle.com/cd/E18941_01/tutorials/setupmobileapps/jdtut_...

    20 08/09/2014 09:17 p. m.

  • 8/10/2019 Oracle JDeveloper 11g Tutorials android.pdf

    6/20

    Click OKto dismiss the Preferences pane.17.

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

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

    The Android Virtual Device Manager dialog is displayed.

    19.

    cle JDeveloper 11g Tutorials http://docs.oracle.com/cd/E18941_01/tutorials/setupmobileapps/jdtut_...

    20 08/09/2014 09:17 p. m.

  • 8/10/2019 Oracle JDeveloper 11g Tutorials android.pdf

    7/20

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

    AVD Name= ADFmf

    Device= Nexus One

    Target= Android 4.2 - API Level 17Internal Storage= 500 MiB

    SD Card= 500 MiB

    Back Camera= Emulated

    Memory Options Ram= 768

    20.

    For the remainder, keep the defaults and click the OKbutton.

    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.

    21.

    cle JDeveloper 11g Tutorials http://docs.oracle.com/cd/E18941_01/tutorials/setupmobileapps/jdtut_...

    20 08/09/2014 09:17 p. m.

  • 8/10/2019 Oracle JDeveloper 11g Tutorials android.pdf

    8/20

    A notification of the new AVD is displayed. Click OKto dismiss it.22.

    Select the new AVD and click the Startbutton.23.

    cle JDeveloper 11g Tutorials http://docs.oracle.com/cd/E18941_01/tutorials/setupmobileapps/jdtut_...

    20 08/09/2014 09:17 p. m.

  • 8/10/2019 Oracle JDeveloper 11g Tutorials android.pdf

    9/20

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

    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.

    25.

    cle JDeveloper 11g Tutorials http://docs.oracle.com/cd/E18941_01/tutorials/setupmobileapps/jdtut_...

    20 08/09/2014 09:17 p. m.

  • 8/10/2019 Oracle JDeveloper 11g Tutorials android.pdf

    10/20

    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.

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

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

    cle JDeveloper 11g Tutorials http://docs.oracle.com/cd/E18941_01/tutorials/setupmobileapps/jdtut_...

    e 20 08/09/2014 09:17 p. m.

  • 8/10/2019 Oracle JDeveloper 11g Tutorials android.pdf

    11/20

    In the Name your application page, enter MyMobileAppin the Application Namefield, and click Next.

    3.

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

    cle JDeveloper 11g Tutorials http://docs.oracle.com/cd/E18941_01/tutorials/setupmobileapps/jdtut_...

    e 20 08/09/2014 09:17 p. m.

  • 8/10/2019 Oracle JDeveloper 11g Tutorials android.pdf

    12/20

    Click Nexttwice and in the Name your projectpage, leave the default project name. Examine the Project Features for the ViewControllerproject. Notice that the project

    uses ADF Mobile Framework, HTML and CSS, Java, and JavaScriptproject features.

    5.

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

    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.

    6.

    Right-click on the ViewControllerproject and select NewIn the New Gallery, select Web Tier - HTMLand then the HTML Pageitem. Click OK.

    7.

    cle JDeveloper 11g Tutorials http://docs.oracle.com/cd/E18941_01/tutorials/setupmobileapps/jdtut_...

    e 20 08/09/2014 09:17 p. m.

  • 8/10/2019 Oracle JDeveloper 11g Tutorials android.pdf

    13/20

    Accept the default File Nameand Directory, then click OK.8.

    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.

    9.

    Save your work.10.

    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.

    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.xmlfile as shown.

    1.

    cle JDeveloper 11g Tutorials http://docs.oracle.com/cd/E18941_01/tutorials/setupmobileapps/jdtut_...

    e 20 08/09/2014 09:17 p. m.

  • 8/10/2019 Oracle JDeveloper 11g Tutorials android.pdf

    14/20

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

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

    3.

    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.xmlcheck box is selected, and then click OK.

    4.

    In the Features table, select the newly created feature oracle.success. Under the Features table, click the Contenttab, and locate the Contenttable. Notice that the

    content item oracle.success.1 is created by default.

    5.

    Save your work.6.

    cle JDeveloper 11g Tutorials http://docs.oracle.com/cd/E18941_01/tutorials/setupmobileapps/jdtut_...

    e 20 08/09/2014 09:17 p. m.

  • 8/10/2019 Oracle JDeveloper 11g Tutorials android.pdf

    15/20

    In the Content area, set the Typeproperty is set to Local HTML.7.

    In the Content section, find the URLtext box.

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

    8.

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

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

    cle JDeveloper 11g Tutorials http://docs.oracle.com/cd/E18941_01/tutorials/setupmobileapps/jdtut_...

    e 20 08/09/2014 09:17 p. m.

  • 8/10/2019 Oracle JDeveloper 11g Tutorials android.pdf

    16/20

    Save all your work.11.

    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.

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

    Keep the emulator open and return to JDeveloper and the MyMobileAppapplication.

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

    cle JDeveloper 11g Tutorials http://docs.oracle.com/cd/E18941_01/tutorials/setupmobileapps/jdtut_...

    e 20 08/09/2014 09:17 p. m.

  • 8/10/2019 Oracle JDeveloper 11g Tutorials android.pdf

    17/20

    In the Profile Typedrop-down list, ensure ADF Mobile for Android is selected. Enter Android_Mobile_Native_archive1as the Deployment Profile Name and click OK.3.

    Select the Android Optionsnode and confirm your values look like the ones below.4.

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

    In the Application menu, select Deploy > Android_Mobile_Native_archive.6.

    cle JDeveloper 11g Tutorials http://docs.oracle.com/cd/E18941_01/tutorials/setupmobileapps/jdtut_...

    e 20 08/09/2014 09:17 p. m.

  • 8/10/2019 Oracle JDeveloper 11g Tutorials android.pdf

    18/20

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

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

    shown below.

    8.

    Navigate back to the emulator. Click the Homebutton...

    ...and then the Application iconto refresh the applications.

    You should see the MyMobileAppapplication you have just created and deployed.

    9.

    cle JDeveloper 11g Tutorials http://docs.oracle.com/cd/E18941_01/tutorials/setupmobileapps/jdtut_...

    e 20 08/09/2014 09:17 p. m.

  • 8/10/2019 Oracle JDeveloper 11g Tutorials android.pdf

    19/20

    Click the MyMobileAppicon to start the application.10.

    The MyMobileApp application currently contains your HTML page running inside the ADF Mobile application.

    cle JDeveloper 11g Tutorials http://docs.oracle.com/cd/E18941_01/tutorials/setupmobileapps/jdtut_...

    e 20 08/09/2014 09:17 p. m.

  • 8/10/2019 Oracle JDeveloper 11g Tutorials android.pdf

    20/20

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

    Previous 1 2 Next

    Copyright 2011, Oracle. All rights reserved.

    cle JDeveloper 11g Tutorials http://docs.oracle.com/cd/E18941_01/tutorials/setupmobileapps/jdtut_...