F ADF Mobile Sample Applications

This appendix describes the ADF Mobile sample applications.

This appendix includes the following section:

F.1 Overview of the ADF Mobile Sample Applications

ADF Mobile ships with a set of a sample applications that provide different development scenarios, such as creating the basic artifacts, accessing such device-native features as SMS and e-mail, or performing CRUD (Create, Read, Update, and Delete) operations on a local SQLite database. These applications are in the PublicSamples.zip file at the following location within the JDeveloper installation directory of your development computer:

jdev_install/jdeveloper/jdev/extensions/oracle.adf.mobile/Samples

To view these applications, extract the PublicSamples.zip file to your JDeveloper working directory (typically, this is User Home Directory/jdeveloper/mywork).

Note:

The sample applications that include a default springboard must be extracted to, and opened from, the Samples directory. To enable these applications to function properly, you must ensure that the springboard is added to the classpath by updating the adfmf-application.xml file as described in Section 5.5.1, "How to Configure Application Navigation."

To add the springboard to the classpath:

  1. Open the application from the Samples directory.

  2. In the Applications page of the overview editor for the adfmf-application.xml file, change the springboard option from Default to None.

  3. Choose Default as the springboard option.

  4. Click Save All.

  5. Deploy the application.

These applications, which are described in Table F-1, are complete. Except where noted otherwise, these applications can be deployed to a simulator after you configure the development environment as described in Chapter 3, "Setting Up the ADF Mobile Environment."

Tip:

To get an idea of how to create an ADF Mobile application, review these applications in the order set forth in Table F-1.

Table F-1 ADF Mobile Sample Applications

Recommended Order of Use Application Name Description Additional Resources Required to Run the Sample Application

1

HelloWorld

The "hello world" application for ADF Mobile, which demonstrates the basic structure of the framework. This basic application has a single application feature that is implemented with a local HTML file. Use this application to ascertain that the development environment is set up correctly to compile and deploy an application. See also Section 4.2.2, "What Happens When You Create an ADF Mobile Application."

 

2

CompGallery

This application serves as an introduction to the ADF Mobile AMX UI components by demonstrating all of these components. Using this application, you can change the attributes of these components and see the effects of those changes in real time without recompiling and redeploying the application after each change. See generally Chapter 7, "Creating the ADF Mobile AMX User Interface."

 

3

LayoutDemo

This application demonstrates the user interface layout and shows how to create the various list and button styles that are commonly used in mobile applications. It also demonstrates how to create the action sheet style of a popup component and how to use various chart and gauge components. See Section 7.3, "Creating and Using UI Components" and Section 7.5, "Providing Data Visualization."

This application must be opened from the Samples directory. The Default springboard option must be cleared in the Applications page of the adfmf-application.xml overview editor, then selected again.

4

JavaDemo

This application demonstrates how to bind the user interface to Java beans. It also demonstrates how to invoke EL bindings from the Java layer using the supplied utility classes. See also Section 7.10, "Using Event Listeners" and Section 8.2, "Understanding EL Support."

 

5

Navigation

This application demonstrates the various navigation techniques in ADF Mobile, including bounded task flows and routers. It also demonstrates the various page transitions. See also Section 6.2, "Creating Task Flows."

This application must be opened from the Samples directory. The Default springboard option must be cleared in the Applications page of the adfmf-application.xml overview editor, then selected again.

6

LifecycleEvents

This application implements lifecycle event handlers on the ADF Mobile application itself and its embedded application features. This application shows you where to insert code to enable the applications to perform their own logic at certain points in the lifecycle. See also Section 5.7, "About Lifecycle Event Listeners."

For iOS, the LifecycleEvents sample application logs data to the Console application, located at Applications-Utilities-Console application.

7

DeviceDemo

This application shows you how to use the DeviceFeatures data control to expose such device features as geolocation, e-mail, SMS, and contacts, as well as how to query the device for its properties. See also Section 8.5, "Using the DeviceFeatures Data Control."

You must also run this application on an actual device, because SMS and some of the device properties do not function on an iOS simulator or Android emulator.

8

GestureDemo

This application demonstrates how gestures can be implemented and used in ADF Mobile applications. See also Section 7.4, "Enabling Gestures."

 

9

StockTracker

This application demonstrates how data change events use Java to enable data changes to be reflected in the user interface. It also has a variety of layout use cases, gestures and basic mobile patterns. See also Section 8.7, "Data Change Events."

 

10

HR

This human resources application is a CRUD application that demonstrates a variety of real-world application techniques. It uses a local SQLite database to store its data. The application persists the data between each startup and is based on the default HR schema that ships with all Oracle databases. See generally Chapter 11, "Using the Local Database."

By providing layouts for both iPad and iPhone, this application demonstrates how different types of user interfaces can share the same data model. There are a variety of other patterns demonstrated in the application as well. This application uses a constraint to deliver the content to both an iPhone and iPad device. For more information, see Section 14.2.5, "About Hardware-Related Constraints."

 

11

Skinning

This application demonstrates how to skin applications and add a unique look and feel by either overriding the supplied style sheets or extending them with their own style sheets. This application also shows how skins control the styling of ADF Mobile AMX UI components based on the type of device. See also Section 5.12, "Skinning ADF Mobile Applications."

 

12

PrefDemo

This application demonstrates application-wide and application feature-specific user setting pages. See generally Chapter 13, "Enabling User Preferences"

 

13

Weather1

This application, which does not use Java code, demonstrates using declarative web services. The web services used by this application are SOAP web services, specifically a public web service provided by CDYNE Corporation (http://www.cdyne.com/), that provides weather forecasts by Zip code. Ensure that this service is available before running this application. See, generally, Chapter 9, "Using Web Services."

 

14

Weather2

This application demonstrates using a programmatic invocation of web services and parsing the GenericType object returned into real Java objects. The user interface is then bound to the Java Beans instead of directly to the web service. For more information, see Section 9.6, "Invoking Web Services From Java."

 

15

Weather3

Although this application is identical to the Weather2 sample application, it demonstrates the use of a non-blocking background thread to invoke the web service and how the user interface is updated when the service returns. This application demonstrates how it updates the user interface by flushing the data change events from the thread.

 

16

RESTDemo

This application demonstrates using REST web services. Its two application features, REST-XML and REST-JSON use the same publicly available web service to retrieve the geo-coordinates of a given IP address or domain. The service can return either XML or JSON formats. The REST-XML application feature uses an XSD and creates a URL data control to access the structured data. The user interface binds to that data control. In the REST-JSON version, the URL connection is used directly by the RESTServiceAdapter helper class to invoke the web service and then the response is parsed using the JSONSerializationHelper class and populates a bean data control. The user interface is bound to this bean. For both of the application features, the web service call results in a form and a map. The latter is centered with a marker with the returned geo-coordinate. For more information, see Section 9.2.3, "How to Create a Web Service Data Control Using REST."

 

17

JSExtend

This application demonstrates how to invoke custom JavaScript methods from within an ADF Mobile AMX page. Use this approach to invoke the Apache Cordova APIs that are not included in the DeviceFeatures data control. You can also use this approach to add custom JavaScript methods to an application and invoke them as well. This application also demonstrates calling back to Java from the JavaScript methods. See also Section 5.10.1, "How to Define the Application Content" and Section B.2, "The ADF Mobile Container Utilities API."

 

18

Attachments

This application demonstrates how to use the displayFile method of the DeviceFeatures data control. The application copies several embedded attachments from the application bundle to a location that is accessible on different device platforms and then presents a user interface from which those attachments can be launched. On iOS-powered devices, these attachments are launched within the context of the ADF Mobile application. On Android, the application launches these attachments externally using a third-party application (if the device runs an application that can handle the device type). If the application finds multiple applications that are capable of launching the attachment type, then it displays them within a list. Users then select the application from the list to launch the attachment. For more information, see Section 8.5.9, "How to Use the displayFile Method."

 

19

DVTDemo

This application provides a basic demonstration using different chart types. It also demonstrates how to change the chart layout and formatting. For more information, see Section 7.5, "Providing Data Visualization."