Set Up Your First Android Application Using PhoneGap

Set Up Your First Android Application Using PhoneGap

The Android operating system has created a lot of stir in the landscape of mobile technology. There is a sense of gratification webmasters feel while developing for this platform and it's justifiably so. Android has become a big buzzword, and it's quite tempting to make an app for it.

​

So, if you are one of those considering to build your own Android app, then you've come to the right place. In this tutorial, we will explain you how to create an app with PhoneGap. If building an Android app is your interest, you can follow this tutorial for your purpose.

What is PhoneGap?

PhoneGap is a popular open-source platform that allows developers to build cross-platform mobile applications using HTML, CSS, and JavaScript. It comes with a JavaScript API to build functionalities within your application such as GPS, on-board camera etc., and also interact with them. It's a perfect source for any Android app development company when it comes to developing a bespoke app that is compatible with an array of platforms.

Next, install Eclipse by entering sudo yum install eclipse in the terminal. For those who have Ubuntu installed, run sudo apt-get install eclipse. You can also download Eclipse from its official website.

After this, start installing ADT plugin for Eclipse. Android Development Tool (ADT) is a plugin which creates an environment for developing an Android application. It is also a nice resource to debug an Android application.

You can install ADT by clicking on “install new software” from the Eclipse's window. Now, click on the Add button to add a repository. Here, you'll need to provide a name for your repository as per your choice, and also location by entering https://dl-ssl.google.com/android/eclipse/.

After this, you'll be provided with a checklist containing Developer Tool Items select Next to view the list and items that need to be downloaded. After this, you'll need to accept the License Agreement to finish the process.

Once you are done with installing the ADT plugin for Eclipse, navigate to Window –> Preferences –> Android and set the SDK path of the extracted SDK. After this, go to Window –> Android SDK and AVD Manager. Pick up the most suitable package category, and check all the available items for a complete installation. Click Install to complete the process. The downloading process will consume some time, so be patient and wait for completing the same.

Getting Started with The Mobile App Development

As of now we have created an environment for our application development, next it's time to create an HTML file and then start building our app using PhoneGap. For this, open any code editor and start entering the following HTML code into it. After this, save the file as index.html.

Developing a project in Eclipse requires you to create an Android Virtual Device (AVD) , which provides you with the necessary support to test your app and then installing it on your phone. For this, go to Window (in the Eclipse), and then Android SDK and AVD Manager. Here, choose Virtual Devices, and then New. Here, you'll see a dialogue box wherein you need to provide some crucial details regarding your app including the name, platform, and so on. To finish this step, click on the Create AVD button.

Now, click on Finish to allow Eclipse prepare the necessary structure and files.

Integrating PhoneGap

For this, you need to download and install the PhoneGap binary from your website and extract the same. Within the Eclipse, create two folders in the root project with names- /assets/www and libs. Now, insert the HTML file we created above into /assets/www folder. In the HTML code, substitute the name of the PhoneGap JS with the file you wish to use. Now, copy the JavaScript file to the Eclipse's project /assets/www which you need to take from the extracted PhoneGap archive containing inside the Android folder. Paste the JAR file to /lbs. After this, right-click on the libs folder in Eclipse, and select Configure Build Path. Add the PhoneGap JAR file from the project. Refresh the project and you're done.

After this, we have two have files which need some modifications. They are AndroidManifest.xml and App.java. Click right on AndroidManifest.xml and Open With–> Text Editor. Start searching for the following piece of code in the file.

Ok, we are almost done now. Just a few steps before running the app. Locate the src.folder and open the Activity tag in the xml file. Add android:configChanges="orientation|keyboardHidden,the result will be something like this:

Juana Steves is a technical writer associated with Xicom Ltd. – a trusted software development company. You can also get in touch with her to opt Android Developer for Hire, in case you are looking forward for the same.

Designing a mobile interface is tricky due to a large amount of data and information you want on your mobile device. As the mobile phones are becoming convenient and portable therefore every design, information and content should be incorporated with right design patterns into your mobile system....

A complicated task is to estimate the exact sum of money required to develop an app. It’s like asking what the price of a house will be. Sure, the price greatly depends on a type of a house and its location. You know the price gap between a house in Fort Lauderdale or a mansion in Palm Beach.

When we want to develop our own App then we stuck that which platform should be chosen by us because at present, a lot of platforms are available for App development like Android, Native, Hybrid, Windows, iOS and many more but we should choose the best one that can give us perfect medium to serve...