Writing applications for phones has been a daunting task since every platform uses it's own language and API's. PhoneGap will solve this problem for you by utilizing the browser capabilities. In this session we will see how we can turn a web based application into a native app. We will also look at posibilites to integrate native functionality, like the camera or accelerometer, in our application. The final part of the presentation is about deployment of these applications. Adobe offers a cloud based service called PhoneGap Build which easily builds your application for all platforms.
20. Your app
20
Copy your html/css/javascript to the ‘www’ folder always
include an index.html in the root
REMEMBER: Files run from a filesystem not a webserver!
21. PhoneGap per platform commands
21
install - install a platform SDK to the project
run - run your project on a certain platform
build - build a distributable package for a platform
26. 26
Camera, Capture & Media
Use the device’s library,
camera and microphone to
work with local audio, video
and images.
27. Camera, Capture & Media
function onSuccess(imageData) { // Do stuff with the image!
}
function onFail(message) {
alert('Failed to get the picture: ' + message);
}
var cameraPopoverHandle = navigator.camera.getPicture(onSuccess,
onFail, { destinationType: Camera.DestinationType.FILE_URI,
sourceType: Camera.PictureSourceType.PHOTOLIBRARY });
!
// Reposition the popover if the orientation changes.
window.onorientationchange = function() {
var cameraPopoverOptions = new CameraPopoverOptions(0, 0,
100, 100, 0);
cameraPopoverHandle.setPosition(cameraPopoverOptions);
}
27
29. Contacts
// Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady,
false);
!
// device APIs are available
//
function onDeviceReady() {
var options = new ContactFindOptions();
options.filter="";
filter = ["displayName","organizations"];
navigator.contacts.find(filter, onSuccess, onError,
options);
}
29
49. Conclusion
49
Package web applications as native apps
Enrich applications with native plugins
Quick deployment with PhoneGap Build VS.
fine-tuned deployment with PhoneGap CLI
tools / IDE
If it doesn’t fit the bill? Download or write your
own plugin!
Always remember; your app runs as a local
51. mdkeijzer@ibuildings.nl
@Martin1982
Thank you for listening
Creative Commons License
This work is licensed under a Creative Commons Attribution-
NonCommercial-ShareAlike 3.0 Unported License.
Slides can also be found at:
http://www.slideshare.net/Martin82