-->

01/04/2013

Demo of PhoneGap on an Android

In earlier post we have seen "Basics of PhoneGap". In this post we will see how to transform simple web application (Html 5, Css3, Javascript) into a native android App using PhoneGap.

First i have a simple web application to show the current location based on your devices Geological position. It was written in simple Html 5, Css 3, and Javascript.


Now i want this to convert into Native App for android. As we are not using PhoneGap Cloud services, we need to use the PhoneGap generic code and will try to transform this simple web form to a Native Android App.

Step 1: Download Eclipse IDE, as we decided to go with Android. Then install Android SDK. Then install ADT package.

As i have been doing Android development also lately, i have everything installed on my Mac.
If its a fresh install for you try following the steps mentioned here. Perform Step 2 only.

Step 2: By this step you would have installed the required software and downloaded the Code sample from PhoneGap.

Step 3: Open Eclipse. Click on Project and Choose "Android Application Form Existing Code Base".

Browse till example folder inside android folder. Rename the App as per your requirement. Check the option to copy to your workspace. This will create a copy of your own version for further modification to host your own app.

Click Finish and the project will be opened in eclispse.

Step 4: Once the Project is loaded, as we check "Copy project into workspace", a copy of code will be copied to the workspace you selected, typically it will be "c:/users/xxxx/documents/workspace" in case of windows. "//xxxxx/documents/workspace" incase of Mac.
Now, go to WWW folder of the workspace copy. Delete all the files inside it and paste your Code files (Html 5 + Css 3 + Java scripts).


Step 5:  Go to res --> values --> string.xml and rename the App. I named it "Where Am I".

Result: We are all set and connect your android phone to laptop. and click on the Run button (Big Green button with > symbol.)

These are the snapshots from my Samsung Galaxy S3, Android Device:






We will see more and more information on PhoneGap in upcoming posts.

6 comments:

  1. Sir, please send me the code of this sample at ersaurabh101@gmail.com

    Thanks, i will be waiting for it.

    ReplyDelete
  2. Please also send to petermageto@gmail.com...this is such a great piece

    ReplyDelete
  3. Hi, please send me the code at pcgsistemas@yahoo.com.ar

    Thanks!

    ReplyDelete
  4. hi, can u please send me the code at cnosso[at]gmail.com
    thanks, cheers! :)

    ReplyDelete
  5. Hi,
    I'm student .
    So i need your code of this example to research Phonegap .
    Please send me the code of this sample at popsun1088@gmail.com .
    Thanks, i am waiting for it.

    ReplyDelete
  6. Hello Sir,
    Thank you for this great article. Is it possible to have the sample code of the app for learning purposes?
    Thank you in advance.
    fotsohervro@yahoo.fr

    ReplyDelete