UKOUG ADF Mobile Hands on Day - UK Oracle User Group

streakgrowlInternet and Web Development

Nov 12, 2013 (3 years and 10 months ago)

547 views

7/16/2013
UKOUG ADF Mobile Hands
on Day
Grant Ronald, Director of Product Management
Application Development Tools
Oracle
blogs.oracle.com/grantronald
1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved. 2 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
GLOBAL MOBILE
3G SUBSCRIBERS
3 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 4 4 C Co op py yr riig gh htt © © 2 20 01 12 3,, O Or ra ac clle e a an nd d//o or r iitts s a affffiilliia atte es s.. A Allll r riig gh htts s r re es se er rv ve ed d..
17/16/2013
Gartner: Top 10 Strategic Technology Trends Understanding Mobile Requirements
For 2013
1. Which Device 2. Network Type 3. Feature Integration 4. End users
http://www.forbes.com/sites/ericsavitz/2012/10/23/gartner-top-10-strategic-technology-trends-for-2013/
5 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 6 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Understanding Mobile Requirements Understanding Mobile Requirements
1. Which Device 2. Network Type 3. Feature Integration 4. End users 1. Which Device 2. Network Type 3. Feature Integration 4. End users
 Tablet, Smart Phone, Feature Phone, Laptop
 Screen size
 Wi-Fi, 4G, 3G, offline
 Device capabilities
 Speed
 Web browser capabilities
 Availability
 Processing power
 Do you have control of the devices?
Image: Stuart Miles / FreeDigitalPhotos.net
7 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 8 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
27/16/2013
Understanding Mobile Requirements Understanding Mobile Requirements
1. Which Device 2. Network Type 3. Feature Integration 4. End users 1. Which Device 2. Network Type 3. Feature Integration 4. End users
 Occasional users  Dedicated users
 Browser  GPS  Calendar  Phone
– Frequency of interaction – Internal or External
 Camera  Contacts  SMS
– Length of interaction – Frequency of interaction
– Length of interaction
9 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 10 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
We’ll Just Use Our Existing Web Application Adjusted Web UI for Mobile
11 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 12 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
37/16/2013
It’s Not Just the Screen Size Oracle’s Mobile Computing Strategy
 SIMPLIFY development, enable developers
to easily, secure and extend enterprise
 No mouse
applications and data to mobile device
 Touch gestures
through one common platform
 Harder to type
 EMPOWER the enterprise, enable
 Web browser limitations
employees, partners, customers with out-of-
 Slower network
the-box mobile productivity applications
13 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 14 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Enterprise Mobility Oracle ADF – Multi Channel Framework
Critical Capabilities for B2B
• Smartphone & Tablet Support
• Enterprise Application Integration Support
Cloud
Database
O Or ra ac clle e
Web
A AD DF F
• Management and Security Legacy Systems
• Application Architecture
• Packaged Mobile Applications
Web Services
• Cloud and Hosting Office
Oracle
Mobile
Applications
15 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 16 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
4C Cr re ed de en nt tiia all M Ma an na ag ge em me en nt t,,
S SS SO O & & A Ac cc ce es ss s C Co on nt tr ro oll
A Ap pp p
P Pu us sh h
C Co on nf fiig g H Ha an nd dlle er r
JDBC
7/16/2013
ADF Mobile Overview
 Thin Native container on each
platform
Am I the only one here who doesn’t
– Allows for native application install
know what ADF is?
– Allows for device interaction
 HTML5/JavaScript based Frontend
 Java Backend
– Embeds a light-weight, headless JVM
 Content packaged as reusable
modules
– Implemented as local or remote
content
Image: imagerymajestic/ FreeDigitalPhotos.net
17 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 20 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Oracle ADF Mobile ADF Mobile Architecture
Write Once, Deploy to Many Device Native Container
C Co on nf fiig gu ur ra at tiio on n S Se er rv ve er r
Web
HTML5 & JavaScript Presentation
View
ADF Mobile
AMX View
Local Server
S Se er rv ve er r- -G Ge en ne er ra at te ed d H HT TM ML L
HTML HTML
ADF Controller
O Or ra ac clle e
A AP PN N//G GC CM M P Pu us sh h S Se er rv viic ce es s
A AD DF F M Mo ob biille e Java VM
Business
Logic
Cordova/PhoneGap
S SO OA AP P & & R RE ES ST T S Se er rv viic ce es s
J Ja av va a H HT TM ML L5 5 SQLite
ADF Model
B Bu uiillt t O On n S St ta an nd da ar rd ds s
B Bu uiillt t O On n S St ta an nd da ar rd ds s
Device Mobile
U U U Us s s se e e e E E E Ex x x xiiiis s s st t t tiiiin n n ng g g g S S S Sk k k kiiiilllllllls s s s S S S Se e e et t t t Encrypted Server
Services
Device
SQLite DB
21 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 22 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
57/16/2013
What are Features?
Features on
Springboard
Features
So, where do I start in building my first
ADF Mobile application?
Re-usable self contained
module of an application
Accessed from Springboard
or Navigation Bar
Modularized
Independently secured
Features on Nav-bar
Image: imagerymajestic/ FreeDigitalPhotos.net
23 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 24 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Applications and Features SpringBoard and Navigation Bar (navbar)
Features on Springboard
 An Application is comprised of
 Are the primary mechanism
– A navigation model
for users to navigate the
 Springboard
application's features
 Or navigation bar
 Navbar is suited to a small
 That calls features comprised of
set of features
– AMX pages
 SpringBoard a larger set
– Local HTML
 & you can build a customized
– Or Remote URL content
HTML SpringBoard
– Or packaged features (FARs)
Features on navbar
25 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 26 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
67/16/2013
Break your application into different
features, each feature is like a shrink-
wrapped piece of functionality. Then
Can I start building the pages of my
use the springboard and navbar to
mobile application now?
expose them to the user
Image: Ambro / FreeDigitalPhotos.net Image: imagerymajestic/ FreeDigitalPhotos.net
27 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 28 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
UI Content options ADF Mobile XML Components (AMX)
 Local AMX File
– JSF-like file built visually in
JDeveloper
 XML format built visually in
– Generated into HTML/JS
JDeveloper
on device at RT
 50+ Components
 Remote URL
 Declarative data binding
– ADF Trinidad for Smartphones
– ADF Faces on Tablets
 Cross-platform file display support
– Any third-party site
 Rendered into HTML5
 Local HTML File
on device at RT
– Coded with any third-party
HTML5 frameworks
29 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 30 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
7C Cr re ed de en nt tiia all M Ma an na ag ge em me en nt t,,
S SS SO O & & A Ac cc ce es ss s C Co on nt tr ro oll
A Ap pp p
P Pu us sh h
C Co on nf fiig g H Ha an nd dlle er r
JDBC
7/16/2013
AMX Component Set
• Basic Components • ListView • Forms
Now, I’ve got to get my data from
• Charts
somewhere?
• Gauge
• T-Maps • Carousel • GeoMap
Image: imagerymajestic/ FreeDigitalPhotos.net
31 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 32 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Oracle proprietary and confidential
Business Services Development ADF Mobile Architecture
Device Native Container
C Co on nf fiig gu ur ra at tiio on n S Se er rv ve er r
Web
HTML5 & JavaScript Presentation
View
ADF Mobile
AMX View
Local Server
 Local services/data
S Se er rv ve er r- -G Ge en ne er ra at te ed d H HT TM ML L
HTML HTML
ADF Controller
– Code logic with Java
– Lightweight JVM
A AP PN N//G GC CM M P Pu us sh h S Se er rv viic ce es s
Java VM
– Native library on device
Business
Logic
– SQLite database
Cordova
S SO OA AP P & & R RE ES ST T S Se er rv viic ce es s
SQLite
ADF Model
 Remote services/data
– SOAP
– REST (JSON/XML)
Device Mobile
Encrypted Server
Services Device
SQLite DB
33 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 34 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
87/16/2013
Business Services Development Business Services Development
Local services Local services
 Java classes  Java classes
– Data object – Data object
– Service object – Service object
 SQLite  SQLite
35 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 36 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Business Services Development Business Services Development
public void retriveDepartments() {
Local services Local services
try {
Connection conn = DBConnectionFactory.getConnection();
s_departments.clear();
conn.setAutoCommit(false);
 Java classes  Java classes
PreparedStatement stat = conn.prepareStatement("SELECT * from
– Data object – Data object DEPARTMENTS");
ResultSet rs = stat.executeQuery();
– Service object – Service object
while (rs.next()) {
int id = rs.getInt("DEPARTMENT_ID");
 SQLite  SQLite
String deptName = rs.getString("DEPARTMENT_NAME");
int mgrId = rs.getInt("MANAGER_ID");
int locId = rs.getInt("LOCATION_ID");
Department d = new Department(id, deptName, mgrId, locId);
s_departments.add(d);
}
rs.close();…
37 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 38 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
97/16/2013
Why Web Services?
And what about remote services and
data?
Image: imagerymajestic/ FreeDigitalPhotos.net
39 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 40 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
ADF Mobile Web Service Support Accessing Cached Data in the ADF Mobile UI
 SOAP
– Created using the Web Service Data Control wizard
– Define via a WSDL file
– Allows declarative invocation of WS methods
 REST-XML 1. Data Controls
– Created using the URL Data Control wizard
– Define via an XSD
2. Programmatic
– Allows declarative invocation of WS methods
 REST-JSON
– Connection created using the URL Data Control wizard
– Must be invoked programmatically and results parsed by the developer
– restServiceAdapter and JSON parsers classes provided as a helper utilities
41 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 42 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
107/16/2013
Accessing Cached Data in the ADF Mobile UI Accessing Cached Data in the ADF Mobile UI
 Data Services Pattern
 Declarative binding
 Service Object
 Abstracts the data layer
– Java class for CRUD operations
1. Data Controls 1. Data Controls
– Can represent Java Beans and SOAP/REST
– Wrapped with a Data Control interface
Web Services
– Returns arrays of Data Objects in the get methods
2. Programmatic – Contains all references to data objects for the 2. Programmatic
 Data Object
project
– Java class to hold attributes
 Allows drag & drop binding of data Controls to UI
– Represents a single “row” of a collection
 Bindings are accessed via EL on the page
– Can contain sub-collections
43 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 44 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
SOAP Web Service Data Control SOAP Web Service Data Control
45 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 46 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
117/16/2013
SOAP Web Service Data Control SOAP Web Service Data Control
47 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 48 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
SOAP Web Service Data Control SOAP Web Service Data Control
49 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 50 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
127/16/2013
51 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 52 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
53 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 54 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
137/16/2013
55 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 56 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
REST (URL) Web Service Data Control
PRODUCT
DEMONSTRATION
Working with SOAP web
services
57 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 58 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
147/16/2013
REST (URL) Web Service Data Control REST (URL) Web Service Data Control
59 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 60 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Programmatic SOAP Web Services
PRODUCT
DEMONSTRATION
Working with REST web
services
61 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 62 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
157/16/2013
Programmatic SOAP Web Services Programmatic SOAP Web Services
63 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 64 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Programmatic SOAP Web Services
PRODUCT
DEMONSTRATION
Programmatic SOAP web
services
65 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 66 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
167/16/2013
Programmatic REST Web Services Programmatic REST Web Services
67 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 68 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Creating a Connection Creating a Connection
69 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 70 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
177/16/2013
REST "Get" Example
Creating a Connection
01 public void loadData() {
02 RestServiceAdapter restService = Model.createRestServiceAdapter();
03 restService.clearRequestProperties();
04 restService.setConnectionName("MyConnection");
05
06 restService.setRequestType(RestServiceAdapter.REQUEST_TYPE_GET);
07 restService.setRetryLimit(0);
08 restService.setRequestURI("/WebService/Departments/100");
09 String response = "";
10 try {
11 // For GET request, there is no outgoing payload
12 response = restServiceAdapter.send("");
13 } catch (Exception e) { .. }
71 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 72 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
REST "Get" Example REST "Get" Example
01 public void loadData() { 01 public void loadData() {
02 RestServiceAdapter restService = Model.createRestServiceAdapter(); 02 RestServiceAdapter restService = Model.createRestServiceAdapter();
03 restService.clearRequestProperties(); 03 restService.clearRequestProperties();
04 restService.setConnectionName("MyConnection"); 04 restService.setConnectionName("MyConnection");
05 05
06 restService.setRequestType(RestServiceAdapter.REQUEST_TYPE_GET); 06 restService.setRequestType(RestServiceAdapter.REQUEST_TYPE_GET);
07 restService.setRetryLimit(0); 07 restService.setRetryLimit(0);
08 restService.setRequestURI("/WebService/Departments/100"); 08 restService.setRequestURI("/WebService/Departments/100");
09 String response = ""; 09 String response = "";
10 try { 10 try {
11 // For GET request, there is no outgoing payload 11 // For GET request, there is no outgoing payload
12 response = restServiceAdapter.send(""); 12 response = restServiceAdapter.send("");
13 } catch (Exception e) { .. } 13 } catch (Exception e) { .. }
73 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 74 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
187/16/2013
REST "Get" Example REST "Get" Example
01 public void loadData() { 01 public void loadData() {
02 RestServiceAdapter restService = Model.createRestServiceAdapter(); 02 RestServiceAdapter restService = Model.createRestServiceAdapter();
03 restService.clearRequestProperties(); 03 restService.clearRequestProperties();
04 restService.setConnectionName("MyConnection"); 04 restService.setConnectionName("MyConnection");
05 05
06 restService.setRequestType(RestServiceAdapter.REQUEST_TYPE_GET); 06 restService.setRequestType(RestServiceAdapter.REQUEST_TYPE_GET);
07 restService.setRetryLimit(0); 07 restService.setRetryLimit(0);
08 restService.setRequestURI("/WebService/Departments/100"); 08 restService.setRequestURI("/WebService/Departments/100");
09 String response = ""; 09 String response = "";
10 try { 10 try {
11 // For GET request, there is no outgoing payload 11 // For GET request, there is no outgoing payload
12 response = restServiceAdapter.send(""); 12 response = restServiceAdapter.send("");
13 } catch (Exception e) { .. } 13 } catch (Exception e) { .. }
75 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 76 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
REST "Get" Example REST "Get" Example
01 public void loadData() { 01 public void loadData() {
02 RestServiceAdapter restService = Model.createRestServiceAdapter(); 02 RestServiceAdapter restService = Model.createRestServiceAdapter();
03 restService.clearRequestProperties(); 03 restService.clearRequestProperties();
04 restService.setConnectionName("MyConnection"); 04 restService.setConnectionName("MyConnection");
05 05
06 restService.setRequestType(RestServiceAdapter.REQUEST_TYPE_GET); 06 restService.setRequestType(RestServiceAdapter.REQUEST_TYPE_GET);
07 restService.setRetryLimit(0); 07 restService.setRetryLimit(0);
08 restService.setRequestURI("/WebService/Departments/100"); 08 restService.setRequestURI("/WebService/Departments/100");
09 String response = ""; 09 String response = "";
10 try { 10 try {
11 // For GET request, there is no outgoing payload 11 // For GET request, there is no outgoing payload
12 response = restServiceAdapter.send(""); 12 response = restServiceAdapter.send("");
13 } catch (Exception e) { .. } 13 } catch (Exception e) { .. }
77 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 78 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
197/16/2013
REST "Get" Example REST "Get" Example
01 public void loadData() { 01 public void loadData() {
02 RestServiceAdapter restService = Model.createRestServiceAdapter(); 02 RestServiceAdapter restService = Model.createRestServiceAdapter();
03 restService.clearRequestProperties(); 03 restService.clearRequestProperties();
04 restService.setConnectionName("MyConnection"); 04 restService.setConnectionName("MyConnection");
05 05
06 restService.setRequestType(RestServiceAdapter.REQUEST_TYPE_GET); 06 restService.setRequestType(RestServiceAdapter.REQUEST_TYPE_GET);
07 restService.setRetryLimit(0); 07 restService.setRetryLimit(0);
08 restService.setRequestURI("/WebService/Departments/100"); 08 restService.setRequestURI("/WebService/Departments/100");
09 String response = ""; 09 String response = "";
10 try { 10 try {
11 // For GET request, there is no outgoing payload 11 // For GET request, there is no outgoing payload
12 response = restServiceAdapter.send(""); 12 response = restServiceAdapter.send("");
13 } catch (Exception e) { .. } 13 } catch (Exception e) { .. }
79 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 80 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
REST "Get" Example
01 public void loadData() {
02 RestServiceAdapter restService = Model.createRestServiceAdapter();
03 restService.clearRequestProperties();
04 restService.setConnectionName("MyConnection");
PRODUCT
05
06 restService.setRequestType(RestServiceAdapter.REQUEST_TYPE_GET);
DEMONSTRATION
07 restService.setRetryLimit(0);
08 restService.setRequestURI("/WebService/Departments/100");
09 String response = "";
Programmatic REST web
10 try {
services
11 // For GET request, there is no outgoing payload
12 response = restServiceAdapter.send("");
13 } catch (Exception e) { .. }
81 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 82 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
207/16/2013
Device Features Interaction
 Leverages PhoneGap/Cordova
What about getting access to the
 Drag and drop to use
camera and other device features?
– Email
– SMS
– Contacts
– GPS
– Camera
 Or access programmatically
Image: imagerymajestic/ FreeDigitalPhotos.net
83 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 84 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Consistant Binding to Business Service and
Functions
One of the key features of ADF is this
consistent interface between the
business data/logic and the developer
building the pages
Image: Ambro / FreeDigitalPhotos.net
85 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 86 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
217/16/2013
Static/Dyna
Property EL Expression Sample Value Java API
mic
device.name Static #{deviceScope.device.name} "Joe Smith's iPhone" DeviceManager.getName()
device.platform Static #{deviceScope.device.platform} "iPhone" DeviceManager.getPlatform()
device.version Static #{deviceScope.device.version} "4.3.2", "5.0.1" DeviceManager.getVersion()
device.os Static #{deviceScope.device.os} "iOS" DeviceManager.getOs()
device.model Static #{deviceScope.device.model} "i386", "iPhone3,1" DeviceManager.getModel()
device.phonegap Static #{deviceScope.device.phonegap} "1.0.0" DeviceManager.getPhonegap()
Can I also find out if I have a network
hardware.hasCamera Static #{deviceScope.hardware.hasCamera} true, false DeviceManager.hasCamera()
connection, or which kind of device I hardware.hasContacts Static #{deviceScope.hardware.hasContacts} true, false DeviceManager.hasContacts()
hardware.hasTouchScreen Static #{deviceScope.hardware.hasTouchScreen} true, false DeviceManager.hasTouchScreen()
am running on?
hardware.hasGeolocation Static #{deviceScope.hardware.hasGeolocation} true, false DeviceManager.hasGeolocation()
hardware.hasAccelerometer Static #{deviceScope.hardware.hasAccelerometer} true, false DeviceManager.hasAccelerometer()
hardware.hasCompass Static #{deviceScope.hardware.hasCompass} true, false DeviceManager.hasCompass()
hardware.hasFileAccess Static #{deviceScope.hardware.hasFileAccess} true, false DeviceManager.hasFileAccess()
hardware.hasLocalStorage Static #{deviceScope.hardware.hasLocalStorage} true, false DeviceManager.hasLocalStorage()
hardware.hasMediaPlayer Static #{deviceScope.hardware.hasMediaPlayer} true, false DeviceManager.hasMediaPlayer()
hardware.hasMediaRecorder Static #{deviceScope.hardware.hasMediaRecorder} true, false DeviceManager.hasMediaRecorder()
hardware.networkStatus Dynamic #{deviceScope.hardware.networkStatus} "wifi","2g","unknown" DeviceManager.getNetworkStatus()
hardware.screen.width Dynamic #{deviceScope.hardware.screen.width} 320, 480 DeviceManager.getScreenWidth()
hardware.screen.height Dynamic #{deviceScope.hardware.screen.height} 480, 320 DeviceManager.getScreenHeight()
hardware.availableWidth Dynamic #{deviceScope.hardware.availableWidth} <= 320, <= 480 DeviceManager.getAvailableScreenWidth()
hardware.availableHeight Dynamic #{deviceScope.hardware.availableHeight} <= 480, <= 320 DeviceManager.getAvailableScreenHeight()
hardware.screen.dpi Static #{deviceScope.hardware.screen.dpi} 160, 326 DeviceManager.getScreenDpi()
hardware.screen.diagonalSize Static #{deviceScope.hardware.screen.diagonalSize} 9.7, 6.78 DeviceManager.getScreenDiagonalSize()
Image: imagerymajestic/ FreeDigitalPhotos.net
87 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 88 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
hardware.screen.scaleFactor Static #{deviceScope.hardware.screen.scaleFactor} 1.0, 2.0 DeviceManager.getScreenScaleFactor()
89 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 90 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
227/16/2013
91 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 92 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Device Properties API Example
What are the key configuration/setup
01 public class MyBean {
files when building my ADF Mobile
02
application?
03 // Called via a button
04 public void takePhoto(ActionEvent event) {
05 DeviceManager device = DeviceManagerFactory.getDeviceManager();
06
07 boolean hasCamera = device.hasCamera();
08 }
Image: imagerymajestic/ FreeDigitalPhotos.net
93 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 94 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
237/16/2013
adfmf-application.xml – Application Definition adfmf-application.xml – Application Definition
95 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 96 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
adfmf-application.xml – Application Definition adfmf-application.xml – Application "Navigation"
97 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 98 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
247/16/2013
adfmf-feature.xml file – Features Definition adfmf-feature.xml file – Features Definition
99 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 100 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
adfmf-feature.xml file – Features Definition adfmf-feature.xml file – Features Definition
101 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 102 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
257/16/2013
adfmf-feature.xml file – Features "General" adfmf-feature.xml file – Features "Content"
at RT – Other HTML sources
 Local AMX File
– JSF-like file built  Remote URL  Local HTML File
 General description
visually in
– ADF Trinidad for – Coded with any 3rd-
 Springboard/nav-bar icons
JDeveloper
Smartphones party HTML5
– Generated into frameworks
 Feature start/stop lifecycle listener
– ADF Faces on
HTML/JS on device
Tablets
103 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 104 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
adfmf-feature.xml file – Features "Content" adfmf-feature.xml file – Features "Constraints"
AMX Local HTML RemoteURL
 Use device properties, hardware or user evaluation
• Should be considered default • Incorporate pages developed • Incorporate mobile-friendly
content type for new apps using third party HTML5 controls Remote Web Content into the
 Evaluate with operator, if true then feature is displayed
• Offline Support such as JQueryMobile ADF Mobile App
• Integration with device services • Implement moving/dropping • Extend existing web application
like camera Google Map markers to leverage device services
01 <constraint property="user.roles" operator="contains"
• Data Visualization requirements • Use webview browser to display • Complements AMX/Local HTML
02 value="manager_role"/>
– charts, graphs, gauges file content such as PDF features with local data cache
• Declarative – future proof for with full set of server-side data
extensibility support and functionality
105 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 106 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
267/16/2013
adfmf-feature.xml file – Features adfmf-feature.xml file – Features "Security"
"Preferences"
 As per the application level  Does the feature require the user be authenticated before accessing
 Requires the application is configured for security in the adfmf-
application.xml file.
107 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 108 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Deploying
Get familiar with these two
files/dialogs, you’ll spend a lot of time
 Create deployment profile
using them
– Separate for Android / iOS
 Set appropriate properties
 Choose Release or Debug Mode
 Deploy
– To device
– Emulator
– Package
Image: Ambro / FreeDigitalPhotos.net
109 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 110 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
277/16/2013
OS Specific Options Debugging
iOS and Android
 Uses remote Java debugging – from device or emulator
 Set debug options in cvm.properties file
– Debug=true, port number
 Verify “remote debug” in viewController project run/debug settings
 Android - Start adb port forwarding for debug
– adb -d forward tcp:8000 tcp:8000
 Debug application
111 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 112 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Logging Logging API
 Set in logging.properties  Java Script Logging
– adf.mf.log.Application.logp(adf.mf.log.level.WARNING, "myClass",
 Logging starts at the same time as the application
"myMethod", "My Message");
 Only the contents of the current run is available
 Java Logging
 The log output is same name as the application
– Logger.getLogger( Utility.APPLICATION_LOGNAME).logp(
 The logging.properties file is created in /.adf/META-INF directory
Level.WARNING, this.getClass().getName(), "onTestMessage",
 By default all loggers use the com.sun.util.logging.ConsoleHandler with "embedded warning message 2");
SimpleFormatter, and the log level set to SEVERE
113 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 114 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
287/16/2013
iOS Logging Android Logging
 Simulator : MAC Console : Applications - Utilities - Console.app  Emulator : DDMS :<android sdk home>/tools/ddms
 Device : XCode Organizer with the device connected  Device: LogCat Application (external application to install)
115 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 116 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Summary
 Mobile Applications are not the same as regular applications
 Consider use-case to pick the right architecture
 Oracle ADF Mobile – On-Device iOS and Android Applications
 Abstract Complexity and Simplify Development
 Reuse your Java and ADF skills
117 Copyright © 2013, Oracle and/or its affiliates. All rights reserved. 118 Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
29