Sunday 12 November 2017

Using PhoneGap in Eclipse to develop applications for Android or other mobile platforms

If you have been hearing a lot about this new kid on the mobile development block - PhoneGap (http://phonegap.com), and are as confused as I was when I started diving deeper, you've come to the right place to sort out your understanding a bit.

1)What is phonegap?

"PhoneGap is an open source solution for building cross-platform mobile apps with modern, standards-based Web technologies. Based on HTML5, PhoneGap leverages web technologies developers already know best... HTML and JavaScript."
The meaning itself does not make things very clear though. Let me explain clearly. So today, suppose you have a web application that you want to organize on multiple platform, say Android, iPhone, etc. In this app, you want to use one or more of the platform services to obtain some kind of data or carry out some kind of processing. That means, if you're the developer of such an app, you'll most probably have to deal with consuming the platform's contact book using, for doing which, each platform would obviously have its own different ways. So there are 2 problems here:
1) How can you query the platform's contact book from within your web application which is being written in javascript and has no knowledge of the platform's APIs.
2) How can you do so in a platform agnostic way, so that your web app works not just on Android but also on iPhone, notwithstanding the different ways of using the contacts book in both.

Phonegap tries to be the response to both of the above questions. How? It gives APIs which conceptual the stage's contact book for you, so you just manage the Phonegap API and let phonegap do whatever is left of the enchantment for you.

2) How do I set up/install Phonegap on my system?

This present one's not as insignificant as a setup.exe, unfortunately! Phonegap requires a group of things to be introduced on the machine before beginning. I discovered this archive about introducing phonegap - http://wiki.phonegap.com/w/page/16494774/Getting-started-with-Android-PhoneGap-in-Eclipse. Tragically, I sat down doing every one of the means and till a couple of hours, I was not in any case ready to make my first phonegap hi world application.

Along these lines, the best activity here is to take after the above archive till the "step 1f" i.e. install eclipse, android sdk, android advancement devices, apache ANT, and ruby. What's more, you're practically done! Truly, don't get scared by the rest of the means in the doc. Stage 2 onwards is a more extended method for introducing phoneGap and more significant when you wouldn't utilize Eclipse. Also, that as well, doesn't some way or another work as expressed.

Phonegap can be specifically introduced on Eclipseas a module. You should simply go to Help>Install new software>Add and utilize the download website " https://svn.codespot.com/an/eclipselabs.org/portable web-improvement with-phonegap/labels/r1.2/download". At that point ensuring "contact all accessible refresh destinations" is checked, introduce the phonegap module. Voila! No compelling reason to download phonegap sources from github.

3) How do I create my first phonegap application?

On Eclipse, first create a new phonegap project by clicking on the phonegap comnand you see on the coolbar. Then if you don't have downloaded sources for phonegap, check
"Use Built-in PhoneGap" on the project wizard. Click Next and create the new Android project in the Android project wizard. (Note: You can also simply create an Android project, making sure that the android main activity class extends DroidGap class instead of Activity class. Make sure you add "phonegap.jar" as an external library to the build path.).

You see that a phonegap application is only an android application with the fundamental movement class broadening phoneGap's droidgap class and it's onCreate technique stacking a html page as opposed to playing out any local usefulness. You can supplant this html page by one of your own decision in the advantages/www folder. Check out http://mobile.tutsplus.com/tutorials/phonegap/creating-an-android-hello-world-application-with-phonegap/for some great illustrations.


You can now utilize the phonegap APIs, for example, the contacts API, media player API, geolocation API, and so on. Swell is a program based emulator (a chrome augmentation) that you can use to test the PhoneGap applications. (Testing on the Android emulator is somewhat moderate with web applications).

No comments:

Post a Comment