G MAF Sample Applications

This appendix describes the MAF sample applications.

This appendix includes the following section:

G.1 Overview of the MAF Sample Applications

MAF 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.maf/Samples

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

These applications, which are described in Table G-1, are complete. Except where noted otherwise, these applications can be deployed to a simulator after you configure the development environment as described in Oracle Mobile Application Framework Installing Oracle Mobile Application Framework.

Table G-1 MAF Sample Applications

Application Name Description Additional Resources Required to Run the Sample Application

HelloWorld

The "hello world" application for MAF, 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 2.2.2, "What Happens When You Create a MAF Application."

 

ACS

This application provides the REST services that are used within the SecurityDemo application to configure the login server and the Access Control Service.

This web application needs to be deployed on a WebLogic server.

APIDemo

This application demonstrates how to invoke custom JavaScript methods from within a MAF 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. For more information, see Section 3.3, "Setting Display Properties for an Application Feature" and Section B.2, "The MAF Container Utilities API."

 

BarcodeDemo

This application demonstrates how to make use of a Cordova plugin by calling the BarcodeScanner plugin from embedded JavaScript that is invoked from a backing bean. For more information, see Chapter 9, "Using Plugins in MAF Applications."

 

CompGallery

This application serves as an introduction to the MAF 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 13, "Creating the MAF AMX User Interface."

 

ConfigServiceDemo

This application demonstrates the use of the Configuration Service to change the end points used in a MAF application. Changes to end points in connections.xml are propagated to the application on the device and the application re-initialized to consume the new end points. For more information, see Section 16.1, "Introduction to Configuring End Points in MAF Applications."

 

DeviceDemo

This application shows you how to use the DeviceFeatures Data Control to expose device features such as geolocation, e-mail, SMS, and contacts, as well as how to query the device for its properties. This application also demonstrates how to use the displayFile method from the DeviceFeatures data control to display various types files like .doc, .ppt, .xls, and .png. For more information, see Section 14.11, "Using the DeviceFeatures Data Control" and Section 14.11.9, "How to Use the displayFile Method to Enable Displaying Files."

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

ExpandCollapseComponent

This application demonstrates how to create a custom component that can act as a container for any type of AMX component. It also provides an example of expand and collapse functionality. For more details look at the cardview.js file in the js folder. This JavaScript file contains a method (expandcollapse.prototype.render) that renders the UI of the component. It also contains a method that demonstrates how to render the child components of the custom component. For more information, see Section 19.1, "Introduction to Creating Custom UI Components."

 

FragmentDemo

This application shows how you can use fragments to define reusable artifacts that can used as templates. It demonstrates how you can have multiple content types for each feature, one for tablet, one for phone, and use the fragment so that you don't have to code the list/form each time.

 

GestureDemo

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

 

LifecycleEvents

This application implements lifecycle event handlers on the MAF 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 Chapter 11, "Using Lifecycle Listeners in MAF Applications."

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

LocalNotificationDemo

This application demonstrates how to schedule and receive local notifications within a MAF application.See also Chapter 24, "Enabling and Using Notifications."

 

MCS Sample

This application demonstrates the use of the MAF MCS utility to access Oracle Mobile Cloud Service (MCS). It is optimized for use with Android and iOS tablets. The MAF MCS utility jar shipped with this application provides a set of APIs that make it easier for MAF developers to use MCS core services like analytics, diagnostics, and storage collections. The source of the utility classes is included for reference.

To run this sample app, you need an Oracle MCS subscription so you can connect to the Oracle Mobile Cloud Service. Within the Oracle MCS instance you need to create at least one mobile user, a mobile backend (MBE) to test against, and one or more sample storage collections that you then assign to the MBE.

Navigation

This application demonstrates the various navigation techniques in MAF, including bounded task flows and routers. It also demonstrates the various page transitions. See also Section 12.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 maf-application.xml overview editor, then selected again.

PrefDemo

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

 

PushDemo

This application demonstrates how to register for and receive push notifications from the Apple Push Notification and Google Could Messaging servers. For more information, see Section 24.2, "Enabling Push Notifications."

This application is used with the PushServer sample application, which provides the ability to initiate a push notification.

PushServer

This application provides the ability to initiate a push notification that is received by the PushDemo sample application. For more information, see Section 24.2, "Enabling Push Notifications."

This web application needs to be deployed on a Weblogic server. This application is used with the PushDemo sample application, which demonstrates how to register for and receive push notifications from the Apple Push Notification and Google Could Messaging servers.

RangeChangeDemo

This application demonstrates how to use a RangeChangeEvent to invoke a Java handler method when the List View requires new data to be fetched from an external source. It also demonstrates how to configure the scrolling and buffering behavior of a List View using its attributes. For more information, see Section 13.3.15.1, "Configuring Paging and Dynamic Scrolling."

 

RESTDemo

This application demonstrates how to use REST web services. The application feature, REST-JSON, uses a publicly available web service to retrieve the geo-coordinates of a given IP address. The service returns data in the JSON format. In the REST-JSON feature, 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 then populating a bean data control. The user interface is bound to this bean. For the application feature, the web service call results in a form and a map. The latter is centered with a marker that contains the returned geo-coordinate.

 

SecurityDemo

This application demonstrates how to secure a MAF application, configure authentication and the login server, use the Access Control Service, and access secure web services. For more information, see Section 29.1, "Introduction to MAF Security."

This application is used with the ACS sample application, which provides the REST services used to configure the login server and the Access Control Service.

SkinningDemo

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 MAF AMX UI components based on the type of device. It also demonstrates the ability to change skin families (out-of-the-box or custom) at runtime. See also Chapter 7, "Skinning MAF Applications."

 

SlidingWindows

This application demonstrates the use of the AdfmfSlidingWindowUtilities API, which can be used to display multiple features on the screen at the same time. This sample shows how you can create a custom springboard or create a global navigation bar using the AdfmfSlidingWindowUtilities API.

 

StockTracker

This sample demonstrates how data change events use Java to enable data changes to be reflected in the user interface. It has a variety of layout use cases, gestures, and basic mobile patterns. This sample also demonstrates how to use client-side validations with the amx:validationGroup component. Within the Portfolio feature, look at editStock.amx for details. See also Section 14.13, "About Data Change Events."

 

UIDemo

This application demonstrates the user interface layout and shows how to create the various list and button styles that are commonly used in MAF 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 also Section 13.3, "Creating and Using UI Components" and Section 13.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 maf-application.xml overview editor, then selected again.

URLSchemeDemo

This application demonstrates how to define a custom URL scheme for your application so that you can invoke it from a URL link in a browser or e-mail. See also Section 20.4, "Invoking MAF Applications Using a Custom URL Scheme."

 

WorkBetter

This human resources application contains two features: People and Organizations.People: This feature includes a search component, which allows you to search for people. It also demonstrates the ability to create custom components as well as how to build reusable layouts as fragments and use them between different features. It demonstrates how to use various DVT visualization components to display performance, compensation, and timeline- related information.Organizations: Like the People feature, this feature demonstrates how to build reusable layouts as fragments and use them between different features. It also demonstrates how to create views for different form factors and configure them.

This application is meant to be an end-to-end demo of the various UI techniques and components available. It shows a variety of layout patterns and demonstrates various uses for both common and more complex components. It is not meant to showcase a compete application but rather focus on the user interface. Please consult other samples for things like data-model or web services.