Contents · Apache Cordova and PhoneGap ..... 10 A Challenge in Mobile Development ..... 11...

7
Contents Acknowledgments .................................................... xiii Foreword ........................................................... xv Introduction ......................................................... xvii PART I Understanding the Oracle Mobile Application Framework 1 Introduction to Mobile Application Development 3 A Short History ....................................................... 4 Mobile Design Principles ............................................... 5 Mobile Platforms ..................................................... 8 What Is iOS? ................................................... 9 What Is Android? ............................................... 9 What About Windows? ........................................... 9 What Technologies Do I Need to Know? .................................... 9 HTML5 ............................................................. 10 CSS3 ......................................................... 10 JSON ........................................................ 10 Apache Cordova and PhoneGap .................................... 10 A Challenge in Mobile Development ...................................... 11 Introducing Oracle Mobile Application Framework ........................... 12 The Mobile Application Framework Runtime Architecture ...................... 12 Server-Side Components of the Oracle Mobile Application Framework Runtime Architecture ....................... 14 Developing with the Oracle Mobile Application Framework .................... 14 Design the Oracle Mobile Application Framework Application . . . . . . . . . . . . . 14 Develop the Oracle Mobile Application Framework Application ........... 15 v

Transcript of Contents · Apache Cordova and PhoneGap ..... 10 A Challenge in Mobile Development ..... 11...

Page 1: Contents · Apache Cordova and PhoneGap ..... 10 A Challenge in Mobile Development ..... 11 Introducing Oracle Mobile Application Framework ..... 12 The Mobile Application Framework

Oracle TIGHT / Oracle Mobile Application Framework Developer Guide / Luc Bors / 085-5 Oracle TIGHT / Oracle Mobile Application Framework Developer Guide / Luc Bors / 085-5

Contents

Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiiiForeword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvIntroduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii

PART IUnderstanding the Oracle Mobile Application Framework

1 Introduction to Mobile Application Development . . . . . . . . . . . . . . . . . . . . . 3A Short History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4Mobile Design Principles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5Mobile Platforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

What Is iOS? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9What Is Android? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9What About Windows? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

What Technologies Do I Need to Know? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9HTML5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

CSS3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10JSON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10Apache Cordova and PhoneGap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

A Challenge in Mobile Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11Introducing Oracle Mobile Application Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . 12The Mobile Application Framework Runtime Architecture . . . . . . . . . . . . . . . . . . . . . . 12

Server-Side Components of the Oracle Mobile Application Framework Runtime Architecture . . . . . . . . . . . . . . . . . . . . . . . 14

Developing with the Oracle Mobile Application Framework . . . . . . . . . . . . . . . . . . . . 14Design the Oracle Mobile Application Framework Application . . . . . . . . . . . . . 14Develop the Oracle Mobile Application Framework Application . . . . . . . . . . . 15

v

00-FM.indd 5 8/28/14 4:53 PM

Page 2: Contents · Apache Cordova and PhoneGap ..... 10 A Challenge in Mobile Development ..... 11 Introducing Oracle Mobile Application Framework ..... 12 The Mobile Application Framework

Oracle TIGHT / Oracle Mobile Application Framework Developer Guide / Luc Bors / 085-5 Oracle TIGHT / Oracle Mobile Application Framework Developer Guide / Luc Bors / 085-5

vi Oracle Mobile Application Framework Developer Guide

Deploy the Oracle Mobile Application Framework Application . . . . . . . . . . . . 16Other Tasks During Application Development . . . . . . . . . . . . . . . . . . . . . . . . . 16Deploy the Oracle Mobile Application

Framework Application to Production . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2 Setting Up Oracle JDeveloper and Your Development Platform . . . . . . . . . . 19Preparing for Android Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

Downloading and Installing Android APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20The Android Emulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21Android Emulator Intel HAXM Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

Preparing for iOS Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27The iOS Developer Program and the Apple ID . . . . . . . . . . . . . . . . . . . . . . . . . 28Application Distribution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28Downloading Xcode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29Launching the iOS Simulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30Using Multiple Versions of iOS Simulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

Setting Up Oracle JDeveloper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33Setting Up Oracle JDeveloper for Android Development . . . . . . . . . . . . . . . . . 33Setting Up Oracle JDeveloper for iOS Development . . . . . . . . . . . . . . . . . . . . . 34

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

3 Oracle JDeveloper for Oracle Mobile Application Framework Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

Quick Overview of Oracle JDeveloper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38Exploring and Customizing the Oracle JDeveloper IDE . . . . . . . . . . . . . . . . . . . . . . . . . 40

The Windows in Oracle JDeveloper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40The Code Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

Creating an Oracle Mobile Application Framework Application . . . . . . . . . . . . . . . . . . 45Version Control in Oracle JDeveloper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

4 Building AMX Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53Introducing Component-Based Development . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

Available Components in the Oracle Mobile Application Framework . . . . . . . . 55Changing Component Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

Layout Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60The List View . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62Creating Your Own List View Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65The PanelSplitter Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

Working with Gestures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72How to Use Gestures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72Reordering Items in a List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

Skinning Oracle Mobile Application Framework Applications . . . . . . . . . . . . . . . . . . . 74Oracle Mobile Application Framework’s Data Visualization Tools . . . . . . . . . . . . . . . . . 76

Creating a Bar Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76Using Gauge Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80Using the Map Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

00-FM.indd 6 8/28/14 4:53 PM

Page 3: Contents · Apache Cordova and PhoneGap ..... 10 A Challenge in Mobile Development ..... 11 Introducing Oracle Mobile Application Framework ..... 12 The Mobile Application Framework

Oracle TIGHT / Oracle Mobile Application Framework Developer Guide / Luc Bors / 085-5 Oracle TIGHT / Oracle Mobile Application Framework Developer Guide / Luc Bors / 085-5

Contents viivi Oracle Mobile Application Framework Developer Guide

Oracle Mobile Application Framework Task Flows Explained . . . . . . . . . . . . . . . . . . . . 84Navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84Global Navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

5 Bindings and Data Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89Creating a Simple Data-Bound Oracle Mobile Application

Framework AMX Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92Responsibilities of the Files Involved in the Model Layer . . . . . . . . . . . . . . . . . . . . . . . . 94

adfm.xml . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94DataControls.dcx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94DataBindings.cpx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

The PageDefinition File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97What Binding Types Are Available? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99What Executables Are Available? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

The Data Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100The Creation of a Bean Data Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100The Data Controls Overview Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

How the Different Parts Connect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104Implementing Validations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107

Interacting with the User . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111Other Data Controls Used by Oracle Mobile Application Framework . . . . . . . . . . . . . . 112Working with Bindings Programmatically . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

Getting and Setting Bound Attribute Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113Invoking Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114

6 Application Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115Oracle Mobile Application Framework Feature

and Application Configuration Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116The Application Configuration File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117The Feature Configuration File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117

Define Application Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117Defining Oracle Mobile Application

Framework Feature Content . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119Oracle Mobile Application Framework Feature Content . . . . . . . . . . . . . . . . . . 119Remote URL and Local HTML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

How to Control the Display of Application Features . . . . . . . . . . . . . . . . . . . . . . . . . . . 122Working with Springboards and Navigation Bars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123

The Navigation Bar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124Springboard Navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

Using an AMX Page as a Custom Springboard . . . . . . . . . . . . . . . . . . . . . . . . . 129Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134

7 Using Web Services and the Local Database . . . . . . . . . . . . . . . . . . . . . . . . . 135Using Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

SOAP-XML vs. REST-JSON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

00-FM.indd 7 8/28/14 4:53 PM

Page 4: Contents · Apache Cordova and PhoneGap ..... 10 A Challenge in Mobile Development ..... 11 Introducing Oracle Mobile Application Framework ..... 12 The Mobile Application Framework

Oracle TIGHT / Oracle Mobile Application Framework Developer Guide / Luc Bors / 085-5 Oracle TIGHT / Oracle Mobile Application Framework Developer Guide / Luc Bors / 085-5

viii Oracle Mobile Application Framework Developer Guide

SOAP-XML Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137REST-XML Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140REST JSON Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142

Using the Local Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143Why Use the SQLite Database? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145How to Use the SQLite Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145Connecting to the SQLite Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146Encrypting the SQLite Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147Limitations of SQLite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147SQLite Creation of Database Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149Data Selection and Manipulation with SQLite . . . . . . . . . . . . . . . . . . . . . . . . . 152

The Concept of Property Change Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157

8 Device Interaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159The Concepts of Device Interaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160

Using the DeviceFeatures Data Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160Using the Java APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165Using the JavaScript APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165The DeviceScope Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166

Implementing Device Interaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167Interacting with the Contact List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167Interacting with the Camera . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169Sending Text Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172Sending E-mails . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172Integrating with GPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172File Display . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

Implementing Common Use Cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175Use Case 1 for Device Interaction: E-mail with Photo Attachment . . . . . . . . . . 175Use Case 2: Tracking Your Daily Workout Session . . . . . . . . . . . . . . . . . . . . . . . 178Use Case 3 for Device Interaction: Creating a Custom Contacts App . . . . . . . . 182

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188

9 Debugging and Testing Oracle Mobile Application Framework Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189

Testing Strategies for Mobile Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190Testing on Real Devices or Using Emulators/Simulators . . . . . . . . . . . . . . . . . . 190

Testing an Oracle Mobile Application Framework Application . . . . . . . . . . . . . . . . . . . 191Unit Testing Oracle Mobile Application Framework Applications . . . . . . . . . . . 191

Debugging an Oracle Mobile Application Framework Application . . . . . . . . . . . . . . . . 191Configure Debug Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192Start a Debug Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194Using Breakpoints to Debug Java Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196The Oracle JDeveloper Debugger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197

00-FM.indd 8 8/28/14 4:53 PM

Page 5: Contents · Apache Cordova and PhoneGap ..... 10 A Challenge in Mobile Development ..... 11 Introducing Oracle Mobile Application Framework ..... 12 The Mobile Application Framework

Oracle TIGHT / Oracle Mobile Application Framework Developer Guide / Luc Bors / 085-5 Oracle TIGHT / Oracle Mobile Application Framework Developer Guide / Luc Bors / 085-5

Contents ixviii Oracle Mobile Application Framework Developer Guide

Debug JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207

10 Security and Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209Oracle Mobile Application Framework Security Concepts . . . . . . . . . . . . . . . . . . . . . . 210

Implementing Login . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210Understanding the Authentication Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211

Deploying Oracle Mobile Application Framework Applications . . . . . . . . . . . . . . . . . . 226Deployment Profiles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226Deploying for the Different platforms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233

PART IIDeveloping the Sample Application

11 Explaining the TAMCAPP Sample Application . . . . . . . . . . . . . . . . . . . . . . . . 237The Data Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239

The Enterprise Data Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239The On-Device Data Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239

The Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240TAMCAPP Application Design and Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241

The Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241Registration and Login . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242The Springboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243Attendees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244Social Media . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245Maps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246Conference Sessions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247

My Schedule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249Speakers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250

Tablet Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253

12 Developing the Springboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255Creating the Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256Defining the Features of the TAMCAPP Application . . . . . . . . . . . . . . . . . . . . . . . . . . . 257

Working with Feature Archives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259Local HTML: The Social Media Feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260Remote URL: The Organizations Remote Feature . . . . . . . . . . . . . . . . . . . . . . . 260

Using Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262Creating the TAMCAPP Custom Springboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269

00-FM.indd 9 8/28/14 4:53 PM

Page 6: Contents · Apache Cordova and PhoneGap ..... 10 A Challenge in Mobile Development ..... 11 Introducing Oracle Mobile Application Framework ..... 12 The Mobile Application Framework

Oracle TIGHT / Oracle Mobile Application Framework Developer Guide / Luc Bors / 085-5 Oracle TIGHT / Oracle Mobile Application Framework Developer Guide / Luc Bors / 085-5

x Oracle Mobile Application Framework Developer Guide

13 Building the Conference Session Feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271Implementing Browse Conference Sessions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273

Connecting to the Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273Creating the Conference-Session Bean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274Creating the Conference Session POJOs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276Creating the Bean Data Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277Building the Conference Session List AMX Page . . . . . . . . . . . . . . . . . . . . . . . . 277Implementing Search for Conference Sessions . . . . . . . . . . . . . . . . . . . . . . . . . 279

Preventing Unnecessary Web Service Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281The Conference Session Detail Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281

Navigating from the List to the Details . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283Viewing the Conference Session Paper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283Creating Visible Track Indicators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285

Setting the Indicator Color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285Evaluate Conference Sessions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286View Conference Session Evaluations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287The Schedule Builder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288

Setting Up the Local SQLite Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289Adding a Conference Session to mySchedule . . . . . . . . . . . . . . . . . . . . . . . . . . 291Synchronizing the Schedule Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294Reading and Writing to the Local Database . . . . . . . . . . . . . . . . . . . . . . . . . . . 295

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300

14 Building the Attendees Feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301Implementing the Attendees List AMX Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303

Implementing Navigation to the Attendee Details AMX Page . . . . . . . . . . . . . . 303Smart Navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305

Implementing the Attendee Details AMX Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306Working with the Attendee Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306

Editing Personal Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311Saving the Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311The Attendee Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315

15 Developing the Maps and Social Network . . . . . . . . . . . . . . . . . . . . . . . . . . . 317Implementing the Maps Feature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318

The Venue Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319The Points of Interest Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325

Embedding the Twitter Timeline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335Exploring the Twitter Widget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335Using the Widget in the Sample Application . . . . . . . . . . . . . . . . . . . . . . . . . . . 336Whitelisting the Twitter Domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338

00-FM.indd 10 8/28/14 4:53 PM

Page 7: Contents · Apache Cordova and PhoneGap ..... 10 A Challenge in Mobile Development ..... 11 Introducing Oracle Mobile Application Framework ..... 12 The Mobile Application Framework

Oracle TIGHT / Oracle Mobile Application Framework Developer Guide / Luc Bors / 085-5 Oracle TIGHT / Oracle Mobile Application Framework Developer Guide / Luc Bors / 085-5

Contents xix Oracle Mobile Application Framework Developer Guide

16 Configuring Security and Preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339The Initial Registration Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340

The Logic Behind the Initial Registration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 340Implementing Security in TAMCAPP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342

TAMCAPP Login . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344Application Preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350Implementing the TAMCAPP Preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352Using Preferences from Java Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355

17 Implementing Push Notifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357Understanding the Push Notification Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358Setting Up the Cloud Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359

Google Cloud Messaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359Setting Up Apple Push Notification Service . . . . . . . . . . . . . . . . . . . . . . . . . . . 361

Creating a Push Notification Provider Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367Configuring the Provider Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367Pushing to Android . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369Pushing to iOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369

Implementing Push Support in TAMCAPP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370Registering with the Provider Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373Configuring How Notifications Are Displayed . . . . . . . . . . . . . . . . . . . . . . . . . 373

Responding to Push Notifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375The onMessage() Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376The Feature Life Cycle Listener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377Working with the Push Notifications Payload . . . . . . . . . . . . . . . . . . . . . . . . . . 379

Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381

18 Enhancing TAMCAPP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383Implementing Tablet Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384

Design Considerations and How the Framework Can Help You . . . . . . . . . . . . 384Using a Barcode Scanner to Register Conference Session Attendances . . . . . . . . . . . . . 392

Explaining the Use of URL Scheme in Oracle Mobile Application Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394

Using Cordova Plugins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398Preparing the TAMCAPP Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399Adding the Android Barcode Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400Adding the iOS Barcode Plugin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401Using the Plugin in the Oracle Mobile Application Framework Application . . . 403

Add a Custom Search Component to TAMCAPP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405Steps to Create the Custom Search Component . . . . . . . . . . . . . . . . . . . . . . . . . 406Preparing the Feature to Use the Component . . . . . . . . . . . . . . . . . . . . . . . . . . 408

Implementing a Background Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413

00-FM.indd 11 8/28/14 4:53 PM