3. PURPOSE IDENTIFY PAIN POINTS
LEARN THE "EASY" WAY
HAPPIER USERS
KEEP BRAIN CELLS
4. COMMON
PAIN POINTS*
PLUGIN ISSUES
XHR / AJAX FAILURES / CSP / CORS
CLI INSTALLATION
ICONS / LAUNCH SCREENS
TREATING PHONEGAP AS A
BROWSER / SERVER
MISUNDERSTANDING PHONEGAP
TOOLS
DATA STORAGE
RESPONSIVE DESIGN
SLOW
DIDN'T EXPECT PLATFORM QUIRKS
*NOT SCIENTIFICALLY DETERMINED
5. CLI
INSTALLATION
WINDOWS SEEMS TO BE
PROBLEMATIC FOR USERS
NETWORK RESTRICTIONS /
PROXIES GET IN THE WAY
OFTEN HAVE DIFFICULTY
CONFIGURING ENVIRONMENT
VARIABLES CORRECTLY
SOMETIMES SECURITY
PROGRAMS CAUSE INSTALL
PROBLEMS
NPM WARNINGS LOOK SCARY
SOME GRUMBLING ABOUT
NUMBER OF PREREQUISITES
13. CLI, DESKTOP,
DEVELOPER, BUILD,
OH MY!
ONE OF THE FIRST
QUESTIONS I ASK:
WHICH TOOL ARE YOU
USING?
DEVELOPER DOESN'T
SUPPORT EVERY PLUGIN
BUILD HAS DIFFERENT
STRUCTURE THAN CLI
DESKTOP'S TEMPLATES
NEED UPDATED
14. CLI Desktop App Developer App Build
What
Command line interface
for creating, building,
managing, and running
PhoneGap apps
Graphical user interface
for creating, managing,
and quickly testing
PhoneGap apps
Mobile app that
connects to the Desktop
app or `phonegap serve`
for rapid iteration
purposes
Cloud service that builds
apps for you without
needing a local
development
environment
Bene鍖ts Complete control
Quickly create, manage,
and serve apps
Rapid iteration with
quick reload
Don't need a local dev
environment
Upload from CLI, .zip,
GitHub
Easy distribution
Disadvantages
Need to install prereqs &
SDKS
More maintenance
Template is out-of-date
Have to use CLI to add
platforms/plugins
Connection dif鍖culties
Only core + select
plugins
lots of edge cases not
present in built apps
Connection dif鍖culties
Different project
structure
PGB vs NPM plugin repo
16. Platform
$ cordova platform add ios@4.1.0 --save
(con鍖g.xml)
<engine name="ios" spec="4.1.0" />
Plugins
$ cordova plugin add cordova-plugin-device@1.1.1
--save
(con鍖g.xml)
<plugin name = "cordova-plugin-device"
spec = "1.1.1" />
PhoneGap Build
CLI Version
<preference name = "phonegap-version"
value = "cli-6.0.0"/>
17. PLUGIN
ISSUES
NOT INSTALLED OR INSTALLED
INCORRECTLY
NOT WAITING FOR
DEVICEREADY
PASSING INCORRECT/
MALFORMED PARAMETERS
PAY ATTENTION TO ERROR
CALLBACK!
DOCUMENTATION IS OFTEN AN
ISSUE
CAN LEAD TO FEELINGS OF
POOR QUALITY
20. localStorage File API Web SQL IndexedDB
SQLite
(1, 2, 3)
App Prefs Keychain
Quota ~5mb n/a 5 - 50mb 5 - 50mb n/a
platform
speci鍖c
platform
speci鍖c
Async? ~ ~
Format Key / String Text / Binary Structured data
Store / Key /
Object
Structured data Key / String Key / String
Good for
Not much
Caching
Temporary data
Saving and
loading
documents
Storing &
querying
structured data
Storing semi-
structured
JavaScript
objects
Large amounts
of structured
data
User Settings
Sensitive
Information
Note
Not persistent,
No callback
Persistent and
temporary 鍖le
systems
Deprecated
Bugged on iOS
(buggy鍖ll)
Keep result set
small!
Not good for
lots of data
Not good for
lots of data
32. 'self' Required to load local resources
gap: UIWebView only (iOS) used by web-native bridge
ws: Web socket support (needed for live reload)
https://ssl.gstatic.com Android TalkBack (Accessibility)
data: Inline images, including SVG use
'unsafe-eval' Try to avoid, but not always possible (live reload / plugins)
'unsafe-inline' Try to avoid, but not always possible (live reload / plugins)
35. if (!navigator.onLine) {
throw new OfflineError(); // offline; don't bother
}
let xhr = new XMLHttpRequest();
xhr.open(method, URI, true);
xhr.timeout = 30000; // 30 second timeout
xhr.ontimeout = function() {
throw new TimeoutError(); // might be offline or unreachable. If online, try
// again (throttle); error after too many failures
// Watch for long-running queries!
}
xhr.onerror = function() {
throw new XHRError(); // try again; error after too many failures
}
xhr.onload = function() {
if (this.status >= 200 && this.status <= 299) { /* success! */ }
else { throw new HTTPError(this.status); }
}
xhr.send(data);
36. ICONS & LAUNCH
SCREENS
PATHS ARE RELATIVE TO
CONFIG.XML
USE MODERN <SPLASH>
AND <ICON> TAGS
MAKE SURE THE IMAGE IS
SAME SIZE AS SPECIFIED
IN CONFIG.XML
KEEP LAUNCH SCREEN
SIMPLE
41. DESIGN
RESPONSIVELY
HTML IS ALREADY RESPONSIVE
RESPONSIVE UNITS (%, REM,
VIEWPORT
UNITS:VH,VW,VMAX,VMIN)
MEDIA QUERIES & DEVICE
PLUGIN
FLEXBOX LAYOUT