SlideShare ist ein Scribd-Unternehmen logo
1 von 28
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

Weitere ähnliche Inhalte

Was ist angesagt?

The WebView Role in Hybrid Applications
The WebView Role in Hybrid ApplicationsThe WebView Role in Hybrid Applications
The WebView Role in Hybrid ApplicationsHaim Michael
 
The Ring programming language version 1.5.4 book - Part 17 of 185
The Ring programming language version 1.5.4 book - Part 17 of 185The Ring programming language version 1.5.4 book - Part 17 of 185
The Ring programming language version 1.5.4 book - Part 17 of 185Mahmoud Samir Fayed
 
LEARNING  iPAD STORYBOARDS IN OBJ-­‐C LESSON 1
LEARNING	 iPAD STORYBOARDS IN OBJ-­‐C LESSON 1LEARNING	 iPAD STORYBOARDS IN OBJ-­‐C LESSON 1
LEARNING  iPAD STORYBOARDS IN OBJ-­‐C LESSON 1Rich Helton
 
C#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 FinalC#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 FinalRich Helton
 
Creation of simple application using - step by step
Creation of simple application using - step by stepCreation of simple application using - step by step
Creation of simple application using - step by steppriya Nithya
 
20150728 100분만에 배우는 windows 10 앱 개발
20150728 100분만에 배우는 windows 10 앱 개발20150728 100분만에 배우는 windows 10 앱 개발
20150728 100분만에 배우는 windows 10 앱 개발영욱 김
 
[Devoxx Morocco 2015] Apache Cordova In Action
[Devoxx Morocco 2015] Apache Cordova In Action[Devoxx Morocco 2015] Apache Cordova In Action
[Devoxx Morocco 2015] Apache Cordova In ActionHazem Saleh
 
How to implement sso using o auth in golang application
How to implement sso using o auth in golang applicationHow to implement sso using o auth in golang application
How to implement sso using o auth in golang applicationKaty Slemon
 
Angular 2 Seminar_(December 7/12/2015)
Angular 2 Seminar_(December 7/12/2015)Angular 2 Seminar_(December 7/12/2015)
Angular 2 Seminar_(December 7/12/2015)Haim Michael
 
The Scala Programming Language
The Scala Programming LanguageThe Scala Programming Language
The Scala Programming LanguageHaim Michael
 
Intro Java Rev010
Intro Java Rev010Intro Java Rev010
Intro Java Rev010Rich Helton
 
Apache Cordova In Action
Apache Cordova In ActionApache Cordova In Action
Apache Cordova In ActionHazem Saleh
 
Android app development Hybrid approach for beginners
Android app development  Hybrid approach for beginnersAndroid app development  Hybrid approach for beginners
Android app development Hybrid approach for beginnersKhirulnizam Abd Rahman
 
Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...
Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...
Desenvolvendo uma aplicação híbrida para Android e IOs utilizando Ionic, aces...Juliano Martins
 
[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova
[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova
[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache CordovaHazem Saleh
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using seleniummindqqa
 
Selenium ide1
Selenium ide1Selenium ide1
Selenium ide1mindqqa
 
Introduction of VS2012 IDE and ASP.NET Controls
Introduction of VS2012 IDE and ASP.NET ControlsIntroduction of VS2012 IDE and ASP.NET Controls
Introduction of VS2012 IDE and ASP.NET ControlsKhademulBasher
 
Mobile Web App development multiplatform using phonegap-cordova
Mobile Web App development multiplatform using phonegap-cordovaMobile Web App development multiplatform using phonegap-cordova
Mobile Web App development multiplatform using phonegap-cordovaKhirulnizam Abd Rahman
 

Was ist angesagt? (20)

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

Andere mochten auch

Select Animal Art from The Nelson Atkins Museum
Select Animal Art from The Nelson Atkins MuseumSelect Animal Art from The Nelson Atkins Museum
Select Animal Art from The Nelson Atkins MuseumJulie Urbanik
 
технология «портфолио» в доу
технология «портфолио» в доутехнология «портфолио» в доу
технология «портфолио» в доу13111977
 
Movie posters and pics
Movie posters and picsMovie posters and pics
Movie posters and picsXin Yi Zyx
 
Diploma Fire Safety Engineering
Diploma Fire Safety EngineeringDiploma Fire Safety Engineering
Diploma Fire Safety Engineeringfiretraining
 
The Benefits & Challenges of OER
The Benefits & Challenges of OERThe Benefits & Challenges of OER
The Benefits & Challenges of OERBrittanyRSimpson
 
8-9 Aralık 2011 AB Hükümet ve Devlet Başkanları Zirvesi Değerlendirmesi
8-9 Aralık 2011 AB Hükümet ve Devlet Başkanları Zirvesi Değerlendirmesi8-9 Aralık 2011 AB Hükümet ve Devlet Başkanları Zirvesi Değerlendirmesi
8-9 Aralık 2011 AB Hükümet ve Devlet Başkanları Zirvesi DeğerlendirmesiGamze Gemici
 
Zoo Marek
Zoo MarekZoo Marek
Zoo Marekklasa6
 
Aprender y enseñar en colaboracion
Aprender y enseñar en colaboracionAprender y enseñar en colaboracion
Aprender y enseñar en colaboraciondianazeron
 
Teknologi informasi dan komunikasi
Teknologi informasi dan komunikasiTeknologi informasi dan komunikasi
Teknologi informasi dan komunikasiangga adien
 
Corporate brochure 07 copy
Corporate brochure 07 copyCorporate brochure 07 copy
Corporate brochure 07 copyManoj Benjamin
 
PB+J = Alteryx & Tableau
PB+J = Alteryx & TableauPB+J = Alteryx & Tableau
PB+J = Alteryx & TableauStephen Wagner
 
Leading through blogging
Leading through bloggingLeading through blogging
Leading through bloggingMichael Niehoff
 
Fitriana bakar (11 044)
Fitriana bakar (11 044)Fitriana bakar (11 044)
Fitriana bakar (11 044)charis_fit
 
лебон г., психология социализма
лебон г., психология социализмалебон г., психология социализма
лебон г., психология социализмаOlga Sakun
 
bloedbad van munchen
bloedbad van munchenbloedbad van munchen
bloedbad van munchenmarnicqvanham
 

Andere mochten auch (19)

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

Ähnlich wie PhoneGap Application Development - Santhi J Krishnan

Android SDK and PhoneGap
Android SDK and PhoneGapAndroid SDK and PhoneGap
Android SDK and PhoneGapDoncho Minkov
 
Methods to set up android app development environment
Methods to set up android app development environmentMethods to set up android app development environment
Methods to set up android app development environmentastoria0128
 
Android development session
Android development sessionAndroid development session
Android development sessionEsraa Ibrahim
 
Android chapter02-setup1-sdk
Android chapter02-setup1-sdkAndroid chapter02-setup1-sdk
Android chapter02-setup1-sdkTran Le Hoan
 
Android Lab Mannual 18SUITSP5.docx
Android Lab Mannual 18SUITSP5.docxAndroid Lab Mannual 18SUITSP5.docx
Android Lab Mannual 18SUITSP5.docxkarthikaparthasarath
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorialAbid Khan
 
Mobile app with cordova
Mobile app with cordovaMobile app with cordova
Mobile app with cordovaCandice Zhuang
 
Android tutorial ppt
Android tutorial pptAndroid tutorial ppt
Android tutorial pptRehna Renu
 
Android studio
Android studioAndroid studio
Android studioAndri Yabu
 
Getting started with android dev and test perspective
Getting started with android   dev and test perspectiveGetting started with android   dev and test perspective
Getting started with android dev and test perspectiveGunjan Kumar
 
Android installation guide
Android installation guideAndroid installation guide
Android installation guidemagicshui
 
Final NEWS.pdf
Final NEWS.pdfFinal NEWS.pdf
Final NEWS.pdfRebaMaheen
 
Final NewsApp.pdf
Final NewsApp.pdfFinal NewsApp.pdf
Final NewsApp.pdfRebaMaheen
 
Titanium Studio [Updated - 18/12/2011]
Titanium Studio [Updated - 18/12/2011]Titanium Studio [Updated - 18/12/2011]
Titanium Studio [Updated - 18/12/2011]Sentinel Solutions Ltd
 

Ähnlich wie PhoneGap Application Development - Santhi J Krishnan (20)

Android SDK and PhoneGap
Android SDK and PhoneGapAndroid SDK and PhoneGap
Android SDK and PhoneGap
 
Methods to set up android app development environment
Methods to set up android app development environmentMethods to set up android app development environment
Methods to set up android app development environment
 
Android development session
Android development sessionAndroid development session
Android development session
 
Android chapter02-setup1-sdk
Android chapter02-setup1-sdkAndroid chapter02-setup1-sdk
Android chapter02-setup1-sdk
 
Android Lab Mannual 18SUITSP5.docx
Android Lab Mannual 18SUITSP5.docxAndroid Lab Mannual 18SUITSP5.docx
Android Lab Mannual 18SUITSP5.docx
 
Android app upload
Android app uploadAndroid app upload
Android app upload
 
Android Basic
Android BasicAndroid Basic
Android Basic
 
Android
Android Android
Android
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Mobile app with cordova
Mobile app with cordovaMobile app with cordova
Mobile app with cordova
 
Mobile app with cordova
Mobile app with cordovaMobile app with cordova
Mobile app with cordova
 
Android tutorial
Android tutorialAndroid tutorial
Android tutorial
 
Android tutorial ppt
Android tutorial pptAndroid tutorial ppt
Android tutorial ppt
 
Android studio
Android studioAndroid studio
Android studio
 
Getting started with android dev and test perspective
Getting started with android   dev and test perspectiveGetting started with android   dev and test perspective
Getting started with android dev and test perspective
 
Android installation guide
Android installation guideAndroid installation guide
Android installation guide
 
Android
AndroidAndroid
Android
 
Final NEWS.pdf
Final NEWS.pdfFinal NEWS.pdf
Final NEWS.pdf
 
Final NewsApp.pdf
Final NewsApp.pdfFinal NewsApp.pdf
Final NewsApp.pdf
 
Titanium Studio [Updated - 18/12/2011]
Titanium Studio [Updated - 18/12/2011]Titanium Studio [Updated - 18/12/2011]
Titanium Studio [Updated - 18/12/2011]
 

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