articles

Home / DeveloperSection / Articles / Introduction to PhoneGap Development

Introduction to PhoneGap Development

Manoj Pandey4661 23-Mar-2015

Applications built with PhoneGap are not just like normal mobile web sites. PhoneGap applications are able to interact with mobile device hardware, such as the Accelerometer or GPS, in ways that are unavailable to normal web applications. PhoneGap applications are also built and packaged like native applications, meaning that they can be distributed through the Apple App Store or the Android Market.

PhoneGap supports a number of different mobile platforms, including:
·    Android
·     iPhone
·     Blackberry
·     Symbian
·     Palm 

The PhoneGap SDK provides an API that is an abstraction layer providing the developer with access to hardware and platform specific features. As PhoneGap abstracts the native mobile platform, the same code can be used on multiple mobile platform with little or no change, making your application available to a wider audience

Hardware specific features supported by the PhoneGap API include:

·     Geolocation
·      Vibration
·      Accelerometer
·      Sound
Requirements:

In order to create applications with PhoneGap, you will need to first install the standard SDK for the mobile platforms you want to target for your app. This is because PhoneGap will actually use these SDKs when compiling your app for that platform. 

So, if you are developing for Android, you will need:

·     Android NDK

·     Android SDK

There are also some additional PhoneGap specific requirements for Android development, including:

·         Eclipse IDE

·         ADT plugin for Eclipse

·         Apache Ant

·         Ruby

·         Git Bash (Windows Only)

If you are developing for the iPhone, you will need:

·         An intel-based Apple Computer

·         iPhone SDK

·         Xcode

·         Mac OS X Snow Leopard

Android

Setup development environment for PhoneGap for Android platform.

1. Installing the Prerequisite software’s.

Eclipse

·   Download Eclipse Classic This will be ZIP file, extract the contents of it.

Java SDK

·     If you don't have the java JDK installed on your system, install the Java SE

Development Kit.

Android SDK

·    Download and install the Android SDK package from here.

ADT plugin for eclipse

Note: If you have trouble acquiring the plugin, try using “http” in the Location URL,

instead of “https”.

Note: While Installation if a warning appears displaying the authenticity or validity

of the software can’t be established, click OK 


·         Open Eclipse, then click on Help -> Install New Software.

·         Click Add, present on the top-right corner.

·         In the new dialog box that appears after clicking Add, enter “ADT Plugin” for the Name and the following URL for the Location: http://dl-ssl.google.com/android/eclipse/

·         Press OK

·         In the Available Software dialog, select the Developer Tools Checkbox then

Press Next.

·         On Next Screen, you‘ll see a list of tools the you are going to download.

Press Press.

·         Read then accept the license agreements, then Press Finish.

·         When the installation completes it will asks for Restart the eclipse, press

restart.

·         After You’ve installed ADT and restarted Eclipse, you must specify the location

of your Android SDK directory:

1.      Select Window > Preferences. To open the Preferences panel (on Mac OS X,

Select Eclipse preferences).

2.      Select Android from the left panel. You may see a dialog asking whether you

want to send usage statistics to Google. If so, make your choice and click Proceed.

3.      For the SDK Location in the main panel click browse... and locate your

downloaded Android SDK directory (such as android-sdk-linux86).

4.      Click Apply, then OK.

2. Download PhoneGap and unzip

Download latest build of PhoneGap from their website http://phonegap.com and

Extract the Contents of it we will deal with the android folder present in the lib

directory.

3. Create New Project

·    Open Terminal and move to the bin folder present in the android directory,

using cd command of terminal.

·   Type the. /create {project_folder_path} {package_name} {project_name} then

press Enter.eg. ./create ~Desktop/myproject com.oodles oodles

·    Open Eclipse then click on File -> New Project.

·    Then a new popup menu will appear select Android -> Android Project from

Existing Code.

·     Then Select Folder where the new Project has been generated through the

create command.

Press Finish.

4. Deployment to Simulator

·     Right click on your current project then move to Run As -> Android Application

·      Eclipse arises a dialog box which ask you to select an AVD. If there is no AVD

Present, then you have create a new one.

To Device

·      First Check USB debugging is not disabled on your device then plug your

device to the system. (Settings > Applications > Development)

·     Right click on your current project and move to Run As -> Android

Application


Updated 31-Mar-2019

Leave Comment

Comments

Liked By