SlideShare a Scribd company logo
Mobile App Development using
Dss Prakash
Agenda
• Why cross platform for mobile development .
• What is PhoneGAP ?
• How does phonegap work..?
• PhoneGap features.
• Setting-up Your PhoneGap Environment.
• Creating “Hello World!” using PhoneGap.
• PhoneGap Plugin development
Dss Prakash
Cross-Platform Mobile Apps
• Design & Build the mobile app using HTML5,CSS3 & JavaScript
• Bind up with Adobe PhoneGap
-> Free Cordova open source framework or PhoneGap build.
-> Get access to native API’s (Accelerometer, Camera,
Compass, Device, Events, File, Geolocation, Media, etc. )
• Deploy to multiple platforms
-> iOS ,Android ,Windows Phone ,Blackberry ,Symbian etc. )
• Multiple Cordova variants availble
-> Telrik App Builder, IBM work light ,HP Anywhare etc.
Dss Prakash
1. PhoneGap is still a product of Adobe. It is a distribution of
Apache Cordova.
Think of Apache Cordova as the engine that powers
PhoneGap.
Dss Prakash
Apache Cordova
• Apache Cordova is a platform for building
natively installed mobile applications
using HTML, CSS and JavaScript
Dss Prakash
What is PhoneGap?
• Build mobile apps using HTML5, Javascript & CSS3
• PhoneGap was originally developed by Nitobi
• In 2011, Adobe acquired Nitobi
• PhoneGap was donated to the Apache Software Foundation
(ASF) under the name Apache Cordova
• Through the ASF, PhoneGap remains free and open source
under the Apache License, Version 2.0
• PhoneGap adds extra features to Cordova (e.g. cloud build)
• http://cordova.apache.org/
• http://phonegap.com/
Dss Prakash
Installing PhoneGap
C:> npm install -g phonegap
$ phonegap create my-app
$ cd my-app
$ phonegap run android
To Install, ensure that you have NodeJS installed, then open your command-line and
run the following:
Install
Usage
PhoneGap Architecture
Dss Prakash
How does PhoneGap Work?
• Include web code in a native app project:
- assets/www/js/, css/, images/, etc.
• Native code loads a URL to the web code through
the device’s internal browser:
- Extend a CordovaWebViewClient
- super.loadUrl( “file:///android_asset/www/login.html” );
• Apache Cordova exposes native device APIs
through JavaScript:
- navigator.device.capture.captureImage( captureSuccess(),
captureError(), [options] );
Dss Prakash
API’s In PhoneGAP
Dss Prakash
1. HTML5 and CCS 3 support.
2. Debugging and profiling .
3. Performance and memory usage.
4. Screen size and orientation .
5. DPI’s .(Dots per inch (dpi) is
a measure of a display's pixel density).
6. User interface – or use just native look.
7. Performance and optimization
Challenges in PhoneGap ..?
1. PhoneGap is not UI framework .
2. PhoneGap doesn't include a browser
and /or rendering engine.
3. PhoneGap doesn't compile .
4. Every platform needs its own compilation.
5. HTML5/CSS3 compatibility.
What is NOT PhoneGap ..?
Creating “Hello World” !
• Creating the Android Project and create a activity extending to
DroidGap
• Add ‘phonegap.jar’ to libs folder <project>/libs
• Add ‘phonegap.jar’ to java build path
• Add the config.xml file located inside xml folder required for
phone gap. Paste the entire xml folder inside res folder
• Add the required permissions to AndroidMainfeast.xml folder
• Creating the HTML (index.html) file and put in assets/www
folder
• Create and start AVD. Run the Application .
Dss Prakash
Dss Prakash
Html Code ..!
Dss Prakash
<!DOCTYPE html>
<html>
<head>
<title>Device Properties Example</title>
<script type="text/javascript" charset="utf-8" src="cordova-2.0.0.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for Cordova to load
document.addEventListener("deviceready", onDeviceReady, false);
// Cordova is ready
function onDeviceReady() {
navigator.geolocation.getCurrentPosition(onSuccess, onError);
}
// onSuccess Geolocation
function onSuccess(position) {
var element = document.getElementById('geolocation');
element.innerHTML = 'Latitude: ' + position.coords.latitude + '<br />' +
'Longitude: ' + position.coords.longitude + '<br />' +
'Altitude: ' + position.coords.altitude + '<br />' +
'Accuracy: ' + position.coords.accuracy + '<br />' +
'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '<br />' +
}
// onError Callback receives a PositionError object
function onError(error) {
alert('code: ' + error.code + 'n' + message: ' + error.message + 'n');
}
</script>
</head>
<body>
<p id="geolocation">Finding geolocation...</p>
</body>
</html>
<!DOCTYPE html>
<html ng-app="myApps">
<head>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<title>PhoneGap Plugins Example</title>
<script
src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
<script type="text/javascript" src="cordova.js"></script>
<script src="js/myApp.js"></script>
<script src="js/controller.js"></script>
</head>
<body><div ng-controller="controller">
<div>
<h1>PhoneGap Plugins Example</h1>
</div>
<p><button class="myButton" ng-click="alertDeviceInfo()">Device</button></p>
<p><button class="myButton" ng-click="alertGeoLocation()">Location</button></p>
<p><button class="myButton" ng-click="beepNotify()">Beep</button></p>
<p><button class="myButton" ng-click="vibrateNotify()">Vibrate</button></p>
</div>
<div>
<a class="myButton" href="Gmap.html">Map</a>
</div>
<script type="text/javascript"> app.initialize();
</script>
</body>
</html>
Index.html
myApp.controller("controller", function($scope){
// Fetch Device info from Device Plugin
$scope.alertDeviceInfo = function() {
var deviceInfo = ('Device Platform: ' + device.platform + 'n'
+ 'Device Version: ' + device.version + 'n' + 'Device Model: '
+ device.model + 'n' + 'Device UUID: ' + device.uuid + 'n');
navigator.notification.alert(deviceInfo);
};
// Fetch location info from GeoLocation Plugin
$scope.alertGeoLocation = function() {
var onSuccess = function(position) {
navigator.notification.alert('Latitude: '
+ position.coords.latitude + 'n' + 'Longitude: '
+ position.coords.longitude + 'n' + 'Altitude: '
+ position.coords.altitude + 'n' + 'Accuracy: '
+ position.coords.accuracy + 'n' + 'Altitude Accuracy: '
+ position.coords.altitudeAccuracy + 'n' + 'Heading: '
+ position.coords.heading + 'n' + 'Timestamp: '
+ position.timestamp + 'n');
};
navigator.geolocation.getCurrentPosition(onSuccess);
};
// Makes a beep sound
$scope.beepNotify = function() {
navigator.notification.beep(1);
};
// Vibrates the phone
$scope.vibrateNotify = function() {
navigator.notification.vibrate(1000);
};
});
Controller.js
var app = {
// Application Constructor
initialize: function() {
this.bindEvents();
},
// Bind Event Listeners
// Bind any events that are required on startup. Common events are:
// 'load', 'deviceready', 'offline', and 'online'.
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
// deviceready Event Handler
// The scope of 'this' is the event. In order to call the 'receivedEvent'
// function, we must explicity call 'app.receivedEvent(...);'
onDeviceReady: function() {
app.receivedEvent('deviceready');
},
// Update DOM on a Received Event
receivedEvent: function(id) {
console.log('Received Event: ' + id);
}
};
var myApp = angular.module('myApps', []);
Index.js
myApp.js
PhoneGAP Advantages..!
• Not required any programming language
• Supportive for all major platforms
• Support for Various API’s
Dss Prakash
Disadvantages of PhoneGAP ..!
• Conditions Apply .
• Can be inefficient when working for native apps .
• Does not support all the functionality.
Dss Prakash
Dss Prakash
• https://build.phonegap.com/
• https://platform.telerik.com/
• https://appery.io/
Thank You
Dss Prakash

More Related Content

What's hot (20)

PDF
Building Mobile Applications with Ionic
Morris Singer
 
PDF
Progressive Web Apps: o melhor da Web appficada
Caelum
 
PDF
The Art of AngularJS in 2015
Matt Raible
 
PDF
HTML5 and the dawn of rich mobile web applications
James Pearce
 
PDF
Single page applications
Diego Cardozo
 
PDF
High Performance Web Design
Koji Ishimoto
 
PDF
State of jQuery June 2013 - Portland
dmethvin
 
PDF
Angular vs React for Web Application Development
FITC
 
PDF
Build single page applications using AngularJS on AEM
connectwebex
 
PDF
CIRCUIT 2015 - Content API's For AEM Sites
ICF CIRCUIT
 
PDF
Anatomy of a Progressive Web App
Mike North
 
PDF
The web - What it has, what it lacks and where it must go - Istanbul
Robert Nyman
 
PDF
Angularjs tutorial
HarikaReddy115
 
PDF
Visual Automation Framework via Screenshot Comparison
Mek Srunyu Stittri
 
PDF
The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...
Robert Nyman
 
PPTX
I/O Rewind 215: What's new in Android
Sittiphol Phanvilai
 
PDF
Lesson learned from 3 years with hybrid apps
Patrik Malmquist
 
PDF
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
Matt Raible
 
PDF
Android JetPack: easy navigation with the new Navigation Controller
Leonardo Pirro
 
PPTX
Webworks
Kang Ibnux
 
Building Mobile Applications with Ionic
Morris Singer
 
Progressive Web Apps: o melhor da Web appficada
Caelum
 
The Art of AngularJS in 2015
Matt Raible
 
HTML5 and the dawn of rich mobile web applications
James Pearce
 
Single page applications
Diego Cardozo
 
High Performance Web Design
Koji Ishimoto
 
State of jQuery June 2013 - Portland
dmethvin
 
Angular vs React for Web Application Development
FITC
 
Build single page applications using AngularJS on AEM
connectwebex
 
CIRCUIT 2015 - Content API's For AEM Sites
ICF CIRCUIT
 
Anatomy of a Progressive Web App
Mike North
 
The web - What it has, what it lacks and where it must go - Istanbul
Robert Nyman
 
Angularjs tutorial
HarikaReddy115
 
Visual Automation Framework via Screenshot Comparison
Mek Srunyu Stittri
 
The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...
Robert Nyman
 
I/O Rewind 215: What's new in Android
Sittiphol Phanvilai
 
Lesson learned from 3 years with hybrid apps
Patrik Malmquist
 
Get Hip with JHipster: Spring Boot + AngularJS + Bootstrap - Devoxx France 2016
Matt Raible
 
Android JetPack: easy navigation with the new Navigation Controller
Leonardo Pirro
 
Webworks
Kang Ibnux
 

Viewers also liked (17)

PDF
Pictavo Yearbook Software Guide
YearbookLife
 
PPTX
лицей29сент2011педсовет
ardabiev
 
PPTX
Nodejs
dssprakash
 
PDF
Southern Arc Minerals Corporate Presentation
SouthernArc
 
PPTX
A-Evropa
Hakon_Bacon
 
PDF
Werkloze jongeren hebben litteken voor het leven
id Plein BV
 
PPT
Yearbook Recognition and Dedication Ads
YearbookLife
 
PPT
School Yearbook Theme
YearbookLife
 
PPT
Yearbook Sales
YearbookLife
 
PPTX
High School Yearbook Cover options
YearbookLife
 
PPT
Yearbook Coverage
YearbookLife
 
PPTX
Vision,Mission,Strategy and Leadership.
Sonia Verma
 
PPT
School Yearbook Staff Monthly Calendar
YearbookLife
 
PPT
02 01 아이디어_발상법-김용경[최종]
Seonghee Jeon
 
PPTX
Baking
Sophia Vadlit
 
PDF
Women entrepreneurship in india by sonia verma
Sonia Verma
 
PPTX
Sensation and Perception
Sophia Vadlit
 
Pictavo Yearbook Software Guide
YearbookLife
 
лицей29сент2011педсовет
ardabiev
 
Nodejs
dssprakash
 
Southern Arc Minerals Corporate Presentation
SouthernArc
 
A-Evropa
Hakon_Bacon
 
Werkloze jongeren hebben litteken voor het leven
id Plein BV
 
Yearbook Recognition and Dedication Ads
YearbookLife
 
School Yearbook Theme
YearbookLife
 
Yearbook Sales
YearbookLife
 
High School Yearbook Cover options
YearbookLife
 
Yearbook Coverage
YearbookLife
 
Vision,Mission,Strategy and Leadership.
Sonia Verma
 
School Yearbook Staff Monthly Calendar
YearbookLife
 
02 01 아이디어_발상법-김용경[최종]
Seonghee Jeon
 
Women entrepreneurship in india by sonia verma
Sonia Verma
 
Sensation and Perception
Sophia Vadlit
 
Ad

Similar to phonegap with angular js for freshers (20)

KEY
Intro to PhoneGap
Ryan Stewart
 
PPTX
PhoneGap - Now and the Future
Tim Kim
 
PPTX
Introduction to Apache Cordova (Phonegap)
ejlp12
 
PDF
Introduction phonegap
Rakesh Jha
 
PDF
Advanced programing in phonegap
Rakesh Jha
 
PDF
Intro to PhoneGap
Jussi Pohjolainen
 
PDF
Creating and Distributing Mobile Web Applications with PhoneGap
James Pearce
 
PDF
Introduction to Phonegap
Andrei Firoiu
 
PPTX
Phone gap development, testing, and debugging
Kongu Engineering College, Perundurai, Erode
 
PDF
Building Cross-Platform Mobile Apps
Troy Miles
 
PDF
Introduction to PhoneGap
RameshNair6
 
PDF
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
Nick Landry
 
PDF
PhoneGap in 60 Minutes or Less
Troy Miles
 
PDF
Fake Your Way as a Mobile Developer Rockstar with PhoneGap
glen_a_smith
 
PDF
Native Javascript apps with Phonegap - De Keijzer
Codemotion
 
PDF
Native Javascript apps with PhoneGap 11-04-2014 Codemotion Rome
Martin de Keijzer
 
PPTX
Phone gap development, testing, and debugging
Kongu Engineering College, Perundurai, Erode
 
PPT
Apache Cordova phonegap plugins for mobile app development
webprogr.com
 
PDF
Introduction to PhoneGap
degarden
 
PPTX
phonegap_101
Asanka Indrajith
 
Intro to PhoneGap
Ryan Stewart
 
PhoneGap - Now and the Future
Tim Kim
 
Introduction to Apache Cordova (Phonegap)
ejlp12
 
Introduction phonegap
Rakesh Jha
 
Advanced programing in phonegap
Rakesh Jha
 
Intro to PhoneGap
Jussi Pohjolainen
 
Creating and Distributing Mobile Web Applications with PhoneGap
James Pearce
 
Introduction to Phonegap
Andrei Firoiu
 
Phone gap development, testing, and debugging
Kongu Engineering College, Perundurai, Erode
 
Building Cross-Platform Mobile Apps
Troy Miles
 
Introduction to PhoneGap
RameshNair6
 
Building Mobile Cross-Platform Apps with HTML5, jQuery Mobile & PhoneGap
Nick Landry
 
PhoneGap in 60 Minutes or Less
Troy Miles
 
Fake Your Way as a Mobile Developer Rockstar with PhoneGap
glen_a_smith
 
Native Javascript apps with Phonegap - De Keijzer
Codemotion
 
Native Javascript apps with PhoneGap 11-04-2014 Codemotion Rome
Martin de Keijzer
 
Phone gap development, testing, and debugging
Kongu Engineering College, Perundurai, Erode
 
Apache Cordova phonegap plugins for mobile app development
webprogr.com
 
Introduction to PhoneGap
degarden
 
phonegap_101
Asanka Indrajith
 
Ad

Recently uploaded (20)

PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 

phonegap with angular js for freshers

  • 1. Mobile App Development using Dss Prakash
  • 2. Agenda • Why cross platform for mobile development . • What is PhoneGAP ? • How does phonegap work..? • PhoneGap features. • Setting-up Your PhoneGap Environment. • Creating “Hello World!” using PhoneGap. • PhoneGap Plugin development Dss Prakash
  • 3. Cross-Platform Mobile Apps • Design & Build the mobile app using HTML5,CSS3 & JavaScript • Bind up with Adobe PhoneGap -> Free Cordova open source framework or PhoneGap build. -> Get access to native API’s (Accelerometer, Camera, Compass, Device, Events, File, Geolocation, Media, etc. ) • Deploy to multiple platforms -> iOS ,Android ,Windows Phone ,Blackberry ,Symbian etc. ) • Multiple Cordova variants availble -> Telrik App Builder, IBM work light ,HP Anywhare etc. Dss Prakash
  • 4. 1. PhoneGap is still a product of Adobe. It is a distribution of Apache Cordova. Think of Apache Cordova as the engine that powers PhoneGap. Dss Prakash
  • 5. Apache Cordova • Apache Cordova is a platform for building natively installed mobile applications using HTML, CSS and JavaScript Dss Prakash
  • 6. What is PhoneGap? • Build mobile apps using HTML5, Javascript & CSS3 • PhoneGap was originally developed by Nitobi • In 2011, Adobe acquired Nitobi • PhoneGap was donated to the Apache Software Foundation (ASF) under the name Apache Cordova • Through the ASF, PhoneGap remains free and open source under the Apache License, Version 2.0 • PhoneGap adds extra features to Cordova (e.g. cloud build) • http://cordova.apache.org/ • http://phonegap.com/ Dss Prakash
  • 7. Installing PhoneGap C:> npm install -g phonegap $ phonegap create my-app $ cd my-app $ phonegap run android To Install, ensure that you have NodeJS installed, then open your command-line and run the following: Install Usage
  • 9. How does PhoneGap Work? • Include web code in a native app project: - assets/www/js/, css/, images/, etc. • Native code loads a URL to the web code through the device’s internal browser: - Extend a CordovaWebViewClient - super.loadUrl( “file:///android_asset/www/login.html” ); • Apache Cordova exposes native device APIs through JavaScript: - navigator.device.capture.captureImage( captureSuccess(), captureError(), [options] ); Dss Prakash
  • 11. 1. HTML5 and CCS 3 support. 2. Debugging and profiling . 3. Performance and memory usage. 4. Screen size and orientation . 5. DPI’s .(Dots per inch (dpi) is a measure of a display's pixel density). 6. User interface – or use just native look. 7. Performance and optimization Challenges in PhoneGap ..?
  • 12. 1. PhoneGap is not UI framework . 2. PhoneGap doesn't include a browser and /or rendering engine. 3. PhoneGap doesn't compile . 4. Every platform needs its own compilation. 5. HTML5/CSS3 compatibility. What is NOT PhoneGap ..?
  • 13. Creating “Hello World” ! • Creating the Android Project and create a activity extending to DroidGap • Add ‘phonegap.jar’ to libs folder <project>/libs • Add ‘phonegap.jar’ to java build path • Add the config.xml file located inside xml folder required for phone gap. Paste the entire xml folder inside res folder • Add the required permissions to AndroidMainfeast.xml folder • Creating the HTML (index.html) file and put in assets/www folder • Create and start AVD. Run the Application . Dss Prakash
  • 15. Html Code ..! Dss Prakash <!DOCTYPE html> <html> <head> <title>Device Properties Example</title> <script type="text/javascript" charset="utf-8" src="cordova-2.0.0.js"></script> <script type="text/javascript" charset="utf-8"> // Wait for Cordova to load document.addEventListener("deviceready", onDeviceReady, false); // Cordova is ready function onDeviceReady() { navigator.geolocation.getCurrentPosition(onSuccess, onError); } // onSuccess Geolocation function onSuccess(position) { var element = document.getElementById('geolocation'); element.innerHTML = 'Latitude: ' + position.coords.latitude + '<br />' + 'Longitude: ' + position.coords.longitude + '<br />' + 'Altitude: ' + position.coords.altitude + '<br />' + 'Accuracy: ' + position.coords.accuracy + '<br />' + 'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '<br />' + } // onError Callback receives a PositionError object function onError(error) { alert('code: ' + error.code + 'n' + message: ' + error.message + 'n'); } </script> </head> <body> <p id="geolocation">Finding geolocation...</p> </body> </html>
  • 16. <!DOCTYPE html> <html ng-app="myApps"> <head> <link rel="stylesheet" type="text/css" href="css/style.css" /> <title>PhoneGap Plugins Example</title> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script> <script type="text/javascript" src="cordova.js"></script> <script src="js/myApp.js"></script> <script src="js/controller.js"></script> </head> <body><div ng-controller="controller"> <div> <h1>PhoneGap Plugins Example</h1> </div> <p><button class="myButton" ng-click="alertDeviceInfo()">Device</button></p> <p><button class="myButton" ng-click="alertGeoLocation()">Location</button></p> <p><button class="myButton" ng-click="beepNotify()">Beep</button></p> <p><button class="myButton" ng-click="vibrateNotify()">Vibrate</button></p> </div> <div> <a class="myButton" href="Gmap.html">Map</a> </div> <script type="text/javascript"> app.initialize(); </script> </body> </html> Index.html
  • 17. myApp.controller("controller", function($scope){ // Fetch Device info from Device Plugin $scope.alertDeviceInfo = function() { var deviceInfo = ('Device Platform: ' + device.platform + 'n' + 'Device Version: ' + device.version + 'n' + 'Device Model: ' + device.model + 'n' + 'Device UUID: ' + device.uuid + 'n'); navigator.notification.alert(deviceInfo); }; // Fetch location info from GeoLocation Plugin $scope.alertGeoLocation = function() { var onSuccess = function(position) { navigator.notification.alert('Latitude: ' + position.coords.latitude + 'n' + 'Longitude: ' + position.coords.longitude + 'n' + 'Altitude: ' + position.coords.altitude + 'n' + 'Accuracy: ' + position.coords.accuracy + 'n' + 'Altitude Accuracy: ' + position.coords.altitudeAccuracy + 'n' + 'Heading: ' + position.coords.heading + 'n' + 'Timestamp: ' + position.timestamp + 'n'); }; navigator.geolocation.getCurrentPosition(onSuccess); }; // Makes a beep sound $scope.beepNotify = function() { navigator.notification.beep(1); }; // Vibrates the phone $scope.vibrateNotify = function() { navigator.notification.vibrate(1000); }; }); Controller.js
  • 18. var app = { // Application Constructor initialize: function() { this.bindEvents(); }, // Bind Event Listeners // Bind any events that are required on startup. Common events are: // 'load', 'deviceready', 'offline', and 'online'. bindEvents: function() { document.addEventListener('deviceready', this.onDeviceReady, false); }, // deviceready Event Handler // The scope of 'this' is the event. In order to call the 'receivedEvent' // function, we must explicity call 'app.receivedEvent(...);' onDeviceReady: function() { app.receivedEvent('deviceready'); }, // Update DOM on a Received Event receivedEvent: function(id) { console.log('Received Event: ' + id); } }; var myApp = angular.module('myApps', []); Index.js myApp.js
  • 19. PhoneGAP Advantages..! • Not required any programming language • Supportive for all major platforms • Support for Various API’s Dss Prakash
  • 20. Disadvantages of PhoneGAP ..! • Conditions Apply . • Can be inefficient when working for native apps . • Does not support all the functionality. Dss Prakash