SlideShare a Scribd company logo
PHONEGAP APPLICATION 
DEVELOPMENT
Setting Up Android ADT And Eclipse 
Although Eclipse IDE is not strictly necessary but it’s the officially 
recommended IDE for Android, it also makes testing, debugging and 
deployment much easier for a beginner. 
What you need to install ? 
 JDK/JRE 
 Eclipse 
 ADT (Android Development Tools) 
WWW.ORISYS.IN 2
Step 1. Install JDK and Eclipse IDE 
 Open a terminal and install Eclipse IDE as well as JDK, in one command 
(Installs Eclipse 3.7 + OpenJDK 6). The command is: 
sudo apt-get install eclipse-jdt 
Step 2. Download Android SDK Starter Package 
 Download Android SDK Starter Package (From Official Site) 
Step 3. Install ADT Plugins for Eclipse 
 Now, Open Eclipse IDE -> select a workspace (any folder created in you system) -> OK. 
 Eclipse launches. Now go to Help -> Install New Software, then click on Add and 
enter the following URL as Location: 
 https://dl-ssl.google.com/android/eclipse/ and Android ADT as name -> OK. 
WWW.ORISYS.IN 3
WWW.ORISYS.IN 4
 Now select the Developer Tools, then a couple of Next, followed by Finish -> Accept the 
terms and conditions -> OK. 
 This would begin the Download/Installation process; once it completes, a warning pop-up 
opens up -> click OK, restart Eclipse. 
WWW.ORISYS.IN 5
Step 4. Install Android SDK 
 Then open Window -> Preferences -> Select Android from left menu and locate your Android 
SDK starter package (You should browse the location of extracted Android SDK starter package) -> 
Apply -> OK. 
WWW.ORISYS.IN 6
 Then go to Window -> Android SDK Manager, Select the packages you want to install 
and click Install [x] Packages. Accept terms and conditions -> OK 
WWW.ORISYS.IN 7
Step 5. Installing Phonegap/Cordova 
 Now, you’ve Android and Java environment ready, install Cordova/Phonegap. 
WWW.ORISYS.IN 8 
Install NodeJS 
 Open a terminal and type: (The NodeJS package available in repository may be out of date, 
so use ppa) 
sudo apt-add-repository -y ppa:chris-lea/node.js 
sudo apt-get -y update 
sudo apt-get -y install NodeJS
WWW.ORISYS.IN 9 
Install Cordova 
 Open a terminal and type: 
sudo npm install -g cordova 
 Open a terminal and type Cordova, just to make sure it’s installed correctly. 
 Now, the development IDE is all set.
Downloading and installing PhoneGap 
 Visit the PhoneGap download page http://phonegap.com/install/ and 
 Download the latest PhoneGap version zip. 
 Extract the archive to your local file system for later use. 
 You are now ready to create your first PhoneGap project for Android within Eclipse. 
WWW.ORISYS.IN 10
Creating the project in Eclipse 
 Follow these steps to create a new Android project in Eclipse: 
WWW.ORISYS.IN 11 
 Choose New > Android Project 
 Other steps will be demonstrated in following slides :
 In the New Android Project dialog box, type a project name and select 
Create New Project In Workspace 
 Click Next. 
WWW.ORISYS.IN 12
WWW.ORISYS.IN 13
WWW.ORISYS.IN 14
WWW.ORISYS.IN 15
Configure the project to use PhoneGap 
Create an assets/www directory and a libs directory inside of the new Android project. 
All of the HTML and JavaScript for your PhoneGap application interface will reside within 
the assets/www folder 
WWW.ORISYS.IN 16
 Copy cordova-x.x.x.js to the assets/www directory within the 
Android project. 
 Copy cordova-x.x.x.jar to the libs directory within the Android 
project. 
 Copy the xml directory into the res directory within the 
Android project 
WWW.ORISYS.IN 17
 Next, create a file named index.html in the assets/www folder. This file will 
be used as the main entry point for your PhoneGap application's interface. 
 In index.html, add the following HTML code to act as a starting point for 
your user interface development: 
<!DOCTYPE HTML> 
<html> 
<head> 
<title>PhoneGap</title> 
<script type="text/javascript" charset="utf-8" src= 
"cordova- 1.5.0.js"></script> 
</head> 
<body> 
<h1>Hello PhoneGap</h1> 
</body> 
</html> 
WWW.ORISYS.IN 18
 You will need to add the cordova-x.x.x.jar library to the build path for the Android project. 
Right-click cordova-x.x.x.jar and select Build Path > Add To Build Path 
WWW.ORISYS.IN 19
WWW.ORISYS.IN 20 
Update the Activity class 
 Open application Activity file. 
 In the main Activity class, add an import statement 
import org.apache.cordova.DroidGap; 
 Change the base class from Activity to DroidGap 
This is in the class definition following the word ‘extends’ 
 Replace the call to setContentView() with a reference to load the PhoneGap interface from the 
local assets/www/index.html file, which you created earlier 
super.loadUrl("file:///android_asset/www/index.html");
WWW.ORISYS.IN 21
 Open AndroidManifest.xml file in project root. 
Use the Eclipse text editor by right-clicking the AndroidManifest.xml file 
and selecting Open With > Text Editor 
WWW.ORISYS.IN 22
 In AndroidManifest.xml, add the following supports-screen XML node as a 
child of the root manifest node: 
<supports-screens 
android:largeScreens="true" 
android:normalScreens="true" 
android:smallScreens="true" 
android:resizeable="true" 
android:anyDensity="true" 
/> 
 Copy the following <uses-permission> XML nodes and paste them as 
children of the root <manifest> node in the AndroidManifest.xml file: 
<uses-permission android:name="android.permission.CAMERA" /> 
<uses-permission android:name="android.permission.VIBRATE" /> 
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 
WWW.ORISYS.IN 23
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> 
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> 
<uses-permission android:name="android.permission.INTERNET" /> 
<uses-permission android:name="android.permission.RECEIVE_SMS" /> 
<uses-permission android:name="android.permission.RECORD_AUDIO" /> 
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> 
<uses-permission android:name="android.permission.READ_CONTACTS" /> 
<uses-permission android:name="android.permission.WRITE_CONTACTS" /> 
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
<uses-permission android:name="android.permission.GET_ACCOUNTS" /> 
<uses-permission android:name="android.permission.BROADCAST_STICKY" /> 
 Locate the <activity> node, which is a child of the <application> XML node. 
Add the following attribute to the <activity> node: 
android:configChanges="orientation|keyboardHidden" 
www.orisys.in 24
Running the application 
 To launch PhoneGap application in the Android emulator, right-click the project 
root, and select Run As > Android Application 
WWW.ORISYS.IN 25
WWW.ORISYS.IN 26 
References 
http://docs.phonegap.com/en/edge/guide_platforms_ubuntu_index.md.html 
http://www.opensourceforu.com/2011/08/build-android-apps-using-html-with-phonegap/ 
http://docs.phonegap.com/en/2.1.0/guide_getting-started_android_index.md.html 
http://phonegap.com/install/
WWW.ORISYS.IN 27 
Questions 
• feedback @ santhi.j.krishnan@orisys.in 
• download slides here : bit.ly/1xmX7bM
THANK YOU

More Related Content

PPTX
Introduction to Android using PhoneGap
PPTX
Learning C# iPad Programming
PDF
I pad uicatalog_lesson02
PDF
tut0000021-hevery
PDF
&lt;img src="../i/r_14.png" />
PDF
Ane for 9ria_cn
PPT
Adobe Flex4
PPTX
Web development tool
Introduction to Android using PhoneGap
Learning C# iPad Programming
I pad uicatalog_lesson02
tut0000021-hevery
&lt;img src="../i/r_14.png" />
Ane for 9ria_cn
Adobe Flex4
Web development tool

What's hot (20)

PDF
The WebView Role in Hybrid Applications
PPTX
JavaScript Basic
PDF
The Ring programming language version 1.5.4 book - Part 17 of 185
PPTX
LEARNING  iPAD STORYBOARDS IN OBJ-­‐C LESSON 1
PPTX
C#Web Sec Oct27 2010 Final
DOCX
Creation of simple application using - step by step
PDF
20150728 100분만에 배우는 windows 10 앱 개발
PPTX
[Devoxx Morocco 2015] Apache Cordova In Action
PDF
How to implement sso using o auth in golang application
PDF
Angular 2 Seminar_(December 7/12/2015)
PDF
The Scala Programming Language
PPT
Intro Java Rev010
PPTX
Apache Cordova In Action
PPTX
Android app development Hybrid approach for beginners
ODP
Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...
PPTX
[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova
PPTX
Test automation using selenium
PPTX
Selenium ide1
PPSX
Introduction of VS2012 IDE and ASP.NET Controls
PPTX
Mobile Web App development multiplatform using phonegap-cordova
The WebView Role in Hybrid Applications
JavaScript Basic
The Ring programming language version 1.5.4 book - Part 17 of 185
LEARNING  iPAD STORYBOARDS IN OBJ-­‐C LESSON 1
C#Web Sec Oct27 2010 Final
Creation of simple application using - step by step
20150728 100분만에 배우는 windows 10 앱 개발
[Devoxx Morocco 2015] Apache Cordova In Action
How to implement sso using o auth in golang application
Angular 2 Seminar_(December 7/12/2015)
The Scala Programming Language
Intro Java Rev010
Apache Cordova In Action
Android app development Hybrid approach for beginners
Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...
[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova
Test automation using selenium
Selenium ide1
Introduction of VS2012 IDE and ASP.NET Controls
Mobile Web App development multiplatform using phonegap-cordova
Ad

Viewers also liked (19)

PPTX
Select Animal Art from The Nelson Atkins Museum
PPT
технология «портфолио» в доу
DOC
Movie posters and pics
PPTX
Ilmu lingkungan
PDF
Bab 4 kls xii
PPTX
Diploma Fire Safety Engineering
PPTX
The Benefits & Challenges of OER
PPTX
PDF
8-9 Aralık 2011 AB Hükümet ve Devlet Başkanları Zirvesi Değerlendirmesi
PPTX
Zoo Marek
PPTX
Aprender y enseñar en colaboracion
DOCX
Teknologi informasi dan komunikasi
DOCX
Ubv trabajo grupal modulo 5
PDF
Corporate brochure 07 copy
PPTX
PB+J = Alteryx & Tableau
PDF
Leading through blogging
PPTX
Fitriana bakar (11 044)
PDF
лебон г., психология социализма
PPTX
bloedbad van munchen
Select Animal Art from The Nelson Atkins Museum
технология «портфолио» в доу
Movie posters and pics
Ilmu lingkungan
Bab 4 kls xii
Diploma Fire Safety Engineering
The Benefits & Challenges of OER
8-9 Aralık 2011 AB Hükümet ve Devlet Başkanları Zirvesi Değerlendirmesi
Zoo Marek
Aprender y enseñar en colaboracion
Teknologi informasi dan komunikasi
Ubv trabajo grupal modulo 5
Corporate brochure 07 copy
PB+J = Alteryx & Tableau
Leading through blogging
Fitriana bakar (11 044)
лебон г., психология социализма
bloedbad van munchen
Ad

Similar to PhoneGap Application Development - Santhi J Krishnan (20)

PPTX
Phone gap
PDF
Phonegap Essentials Building Crossplatform Mobile Apps John M Wargo
PPTX
PPT
Android SDK and PhoneGap
PDF
Introduction to PhoneGap
PPTX
Make Mobile Apps Quickly
PDF
Brian Le Roux Presentation Introducing Phone Gap
KEY
Android development workshop
PPTX
Phonegap for Android
PPTX
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
PDF
PhoneGap
PDF
Steps to setup phonegap
PDF
So you want to Develop on Android....
PDF
Introduction to phone gap
PPT
PPTX
Industrial Training in PhoneGap Application
PPTX
Cross Platform Mobile App Development
PDF
Advanced programing in phonegap
PDF
Introduction phonegap
PDF
Intro to PhoneGap
Phone gap
Phonegap Essentials Building Crossplatform Mobile Apps John M Wargo
Android SDK and PhoneGap
Introduction to PhoneGap
Make Mobile Apps Quickly
Brian Le Roux Presentation Introducing Phone Gap
Android development workshop
Phonegap for Android
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
PhoneGap
Steps to setup phonegap
So you want to Develop on Android....
Introduction to phone gap
Industrial Training in PhoneGap Application
Cross Platform Mobile App Development
Advanced programing in phonegap
Introduction phonegap
Intro to PhoneGap

Recently uploaded (6)

PDF
6-UseCfgfhgfhgfhgfhgfhfhhaseActivity.pdf
PDF
heheheueueyeyeyegehehehhehshMedia-Literacy.pdf
DOC
Camb毕业证学历认证,格罗斯泰斯特主教大学毕业证仿冒文凭毕业证
PDF
Lesson 13- HEREDITY _ pedSAWEREGFVCXZDSASEWFigree.pdf
PPTX
ASMS Telecommunication company Profile
DOC
证书学历UoA毕业证,澳大利亚中汇学院毕业证国外大学毕业证
6-UseCfgfhgfhgfhgfhgfhfhhaseActivity.pdf
heheheueueyeyeyegehehehhehshMedia-Literacy.pdf
Camb毕业证学历认证,格罗斯泰斯特主教大学毕业证仿冒文凭毕业证
Lesson 13- HEREDITY _ pedSAWEREGFVCXZDSASEWFigree.pdf
ASMS Telecommunication company Profile
证书学历UoA毕业证,澳大利亚中汇学院毕业证国外大学毕业证

PhoneGap Application Development - Santhi J Krishnan

  • 2. Setting Up Android ADT And Eclipse Although Eclipse IDE is not strictly necessary but it’s the officially recommended IDE for Android, it also makes testing, debugging and deployment much easier for a beginner. What you need to install ?  JDK/JRE  Eclipse  ADT (Android Development Tools) WWW.ORISYS.IN 2
  • 3. Step 1. Install JDK and Eclipse IDE  Open a terminal and install Eclipse IDE as well as JDK, in one command (Installs Eclipse 3.7 + OpenJDK 6). The command is: sudo apt-get install eclipse-jdt Step 2. Download Android SDK Starter Package  Download Android SDK Starter Package (From Official Site) Step 3. Install ADT Plugins for Eclipse  Now, Open Eclipse IDE -> select a workspace (any folder created in you system) -> OK.  Eclipse launches. Now go to Help -> Install New Software, then click on Add and enter the following URL as Location:  https://dl-ssl.google.com/android/eclipse/ and Android ADT as name -> OK. WWW.ORISYS.IN 3
  • 5.  Now select the Developer Tools, then a couple of Next, followed by Finish -> Accept the terms and conditions -> OK.  This would begin the Download/Installation process; once it completes, a warning pop-up opens up -> click OK, restart Eclipse. WWW.ORISYS.IN 5
  • 6. Step 4. Install Android SDK  Then open Window -> Preferences -> Select Android from left menu and locate your Android SDK starter package (You should browse the location of extracted Android SDK starter package) -> Apply -> OK. WWW.ORISYS.IN 6
  • 7.  Then go to Window -> Android SDK Manager, Select the packages you want to install and click Install [x] Packages. Accept terms and conditions -> OK WWW.ORISYS.IN 7
  • 8. Step 5. Installing Phonegap/Cordova  Now, you’ve Android and Java environment ready, install Cordova/Phonegap. WWW.ORISYS.IN 8 Install NodeJS  Open a terminal and type: (The NodeJS package available in repository may be out of date, so use ppa) sudo apt-add-repository -y ppa:chris-lea/node.js sudo apt-get -y update sudo apt-get -y install NodeJS
  • 9. WWW.ORISYS.IN 9 Install Cordova  Open a terminal and type: sudo npm install -g cordova  Open a terminal and type Cordova, just to make sure it’s installed correctly.  Now, the development IDE is all set.
  • 10. Downloading and installing PhoneGap  Visit the PhoneGap download page http://phonegap.com/install/ and  Download the latest PhoneGap version zip.  Extract the archive to your local file system for later use.  You are now ready to create your first PhoneGap project for Android within Eclipse. WWW.ORISYS.IN 10
  • 11. Creating the project in Eclipse  Follow these steps to create a new Android project in Eclipse: WWW.ORISYS.IN 11  Choose New > Android Project  Other steps will be demonstrated in following slides :
  • 12.  In the New Android Project dialog box, type a project name and select Create New Project In Workspace  Click Next. WWW.ORISYS.IN 12
  • 16. Configure the project to use PhoneGap Create an assets/www directory and a libs directory inside of the new Android project. All of the HTML and JavaScript for your PhoneGap application interface will reside within the assets/www folder WWW.ORISYS.IN 16
  • 17.  Copy cordova-x.x.x.js to the assets/www directory within the Android project.  Copy cordova-x.x.x.jar to the libs directory within the Android project.  Copy the xml directory into the res directory within the Android project WWW.ORISYS.IN 17
  • 18.  Next, create a file named index.html in the assets/www folder. This file will be used as the main entry point for your PhoneGap application's interface.  In index.html, add the following HTML code to act as a starting point for your user interface development: <!DOCTYPE HTML> <html> <head> <title>PhoneGap</title> <script type="text/javascript" charset="utf-8" src= "cordova- 1.5.0.js"></script> </head> <body> <h1>Hello PhoneGap</h1> </body> </html> WWW.ORISYS.IN 18
  • 19.  You will need to add the cordova-x.x.x.jar library to the build path for the Android project. Right-click cordova-x.x.x.jar and select Build Path > Add To Build Path WWW.ORISYS.IN 19
  • 20. WWW.ORISYS.IN 20 Update the Activity class  Open application Activity file.  In the main Activity class, add an import statement import org.apache.cordova.DroidGap;  Change the base class from Activity to DroidGap This is in the class definition following the word ‘extends’  Replace the call to setContentView() with a reference to load the PhoneGap interface from the local assets/www/index.html file, which you created earlier super.loadUrl("file:///android_asset/www/index.html");
  • 22.  Open AndroidManifest.xml file in project root. Use the Eclipse text editor by right-clicking the AndroidManifest.xml file and selecting Open With > Text Editor WWW.ORISYS.IN 22
  • 23.  In AndroidManifest.xml, add the following supports-screen XML node as a child of the root manifest node: <supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:resizeable="true" android:anyDensity="true" />  Copy the following <uses-permission> XML nodes and paste them as children of the root <manifest> node in the AndroidManifest.xml file: <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> WWW.ORISYS.IN 23
  • 24. <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.RECEIVE_SMS" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.WRITE_CONTACTS" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.BROADCAST_STICKY" />  Locate the <activity> node, which is a child of the <application> XML node. Add the following attribute to the <activity> node: android:configChanges="orientation|keyboardHidden" www.orisys.in 24
  • 25. Running the application  To launch PhoneGap application in the Android emulator, right-click the project root, and select Run As > Android Application WWW.ORISYS.IN 25
  • 26. WWW.ORISYS.IN 26 References http://docs.phonegap.com/en/edge/guide_platforms_ubuntu_index.md.html http://www.opensourceforu.com/2011/08/build-android-apps-using-html-with-phonegap/ http://docs.phonegap.com/en/2.1.0/guide_getting-started_android_index.md.html http://phonegap.com/install/
  • 27. WWW.ORISYS.IN 27 Questions • feedback @ santhi.j.krishnan@orisys.in • download slides here : bit.ly/1xmX7bM