Home > Uncategorized > Develop Web Application in Android through HTML, JavaScript, JQuery and Android

Develop Web Application in Android through HTML, JavaScript, JQuery and Android

Here you will learn step by step procedure to develop web application in Android through the HTML, JavaScript, JQuery and Android.

1. Requirements
* Eclipse 3.4+

2. Install SDK + PhoneGap

Download and install Eclipse Classic

Download and install Android SDK

Download and install ADT Plugin

Download the latest copy of PhoneGap and extract its contents. We will be working with the Android directory.

3. Setup New Project
As usual like any other android project setup.
* Launch Eclipse, then under the File menu select New > Android Project
* In the root directory of the project, create two new directories:
o /libs
o /assets/www
* Copy test.js(your JavaScript file) to /assets/www
* Copy phonegap.jar from your PhoneGap download earlier to /libs
* Make a few adjustments too the project’s main Java file found in the src folder in Eclipse:
o Change the class’s extend from Activity to DroidGap
o Replace the setContentView() line with super.loadUrl(“file:///android_asset/www/index.html”);
o Add import com.phonegap.*;
* javaSrc You might experience an error here, where Eclipse can’t find phonegap-0.9.2.jar. In this case, right click on the /libs folder and go to Build Paths/ > Configure Build Paths. Then, in the Libraries tab, add phonegap-0.9.2.jar to the Project. If Eclipse is being temperamental, you might need to refresh (F5) the project once again.
* Right click on AndroidManifest.xml and select Open With > Text Editor
* Paste the following permissions under versionName: (view image below)

* manifest Add android:configChanges=”orientation|keyboardHidden” to the activity tag in AndroidManifest. (view image above)

Example – index.html file

Web Apps in Android with HTML, JavaScript

Hello World

4a. Deploy to a Simulator

* Make sure to change the Active SDK in the top left menu from Use Base SDK to Simulator+version#.
* Hit Build and Run in your project window header.

* Right click the project and go to Run As and click Android Application
* Eclipse will ask you to select an appropriate AVD. If there isn’t one, then you’ll need to create it.
4b. Deploy to a Device

* Make sure USB debugging is enabled on your device and plug it into your system. (Settings > Applications > Development)
* Right click the project and go to Run As and click Android Application

***Note for more details please visit the www.phonegap.com

Advertisements
Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: