Prerequisites
- PhoneGap via NPM
- git
- GitHub account
- QR reader app
(recommended)
Wireless
- octanner.com / 10.0.0.1
- type in your email address
- do NOT press enter;
click the submit button
Install PhoneGap with NPM
$ sudo npm install -g phonegap
SLC JS Learners
- Sean Duncan
- O.C. Tanner Labs
- UtahJS SLC Meetup
- Other meetups
SLC JS Learners - Principles
History & Names
- PhoneGap was created around 2009 by Nitobi.
- In 2011, Adobe bought Nitobi and the PhoneGap brand.
- PhoneGap's source code was donated to the Apache Software Foundation.
-
Apache's open source code is called Cordova.
-
Adobe's PhoneGap extends Cordova.
Supported Cordova Platforms
- Amazon Fire OS
- Android
- BlackBerry 10
- Firefox OS
- iOS
- Ubuntu
- Windows Phone 8
- Windows
- Tizen
Single Page Application (SPA)
- AngularJS
- EmberJS
- Backbone
- Kendo UI
- Monaca
- ReactJS
- Sencha Touch
- jQuery Mobile
- many, many, more
http://alpha.ideavis.co/529cc5f
Let's get codin'
- Create and navigate to your project directory.
$ phonegap create app-name
$ cd app-name
$ phonegap run android
Build Error!!!
[phonegap] executing 'cordova run android'...
No platforms added to this project.
Please use `cordova platform add `.
Push to GitHub
- Create the new project in your GitHub account
echo "# SLC JS Learner's phonegap-demo" >> README.md
$ git init
$ git add .
$ git commit -m "init commit"
$ git remote add origin git@github.com:SLC-JS-Learners/phonegap-demo.git
$ git push -u origin master
Build, baby, build
Download
Test Locally
phonegap serve
- Open the 'listening on' address (e.g.
192.168.8.102:3000
)
Push to GitHub
$ git add .
$ git commit -m "init commit"
$ git push -u origin master
Edit config.xml
- Edit the following fields, as appropriate:
- name
- description
- author email
- Reference:
Review Plug-in API and other resources
Create camera.js
function capturePhoto(){
navigator.camera.getPicture(photoTaken, error,
{
sourceType: 1,
quality: 60
});
}
function photoTaken(data) {
cameraPic.src = data;
alert('Photo taken: ' + cameraPic.src);
}
function error(msg) {
alert('Error: ' + msg);
}
Update index.html
- Delete:
Hello World
Replace with:
- After the line:
Add:
No need to Rebuild
Download and Reinstall
Areas for Improvement & Exploration
- Make the design responsive (e.g. webkit)
- Make camera fully independent
(i.e. no need to route through another app)
- What benefit does the "Developer App" provide?
- What is "hydration"?
- How does it work with Ionic apps?
More Tutorials