Building your first Phonegap android application with HTML and JavaScript
Hello folks!
After days of
research, I have been able to find the optimum method to build an android application using Phonegap. At
first, I had my doubts regarding Phonegap for developing native android
applications. But after research and having developed a massive project in this
platform, I decided to document the steps.
I have tried and
simplified the process for developing an android Phonegap application. At the
end of this tutorial, you will have yourself an android application designed in Phonegap.
To kick-off you have to install 4 files in your system. I have described them in the following steps.
Step 1
Install JDK
Step 2
Install the Android SDK
Make sure you
install the necessary packages in the android sdk manager.
Step 3
Install node.js
Step 4
Install Git
Step 5
Make sure you
restart your computer after installing the packages.
Run command prompt
in your windows machine
You can do so by
typing in 'cmd' in run.
Once you launch the
command prompt, navigate to the C drive or the drive you have installed the
above packages.
After navigating to
the C drive, type in "npm install -g cordova".
Now your command
prompt will look something like this.
Now you have successfully installed Cordova in your drive.
Step 6
Now it is time to
create our first application folder.
Type in the command
prompt "cordova create MyFirstApp com.example.myfirstapp MyFirstApp"
After creating the
application, navigate to the app folder. Type in the command prompt "cd myfirstapp"
Step 7
We will now need to
declare the android target platform. Type in command prompt "cordova
platform add android"
You can check your
installed platforms by the following code:
- C:\CameraApp>cordova platforms ls
You can remove android
by the following code:
- C:\CameraApp>cordova platform rm android
Step 8
Now, build your
application.
C:\CameraApp>cordova build
android
Step 9
After you build your application, follow the folder
structure mentioned in the command prompt and find the APK file.
There you go! You have successfully built your first APK file
using Phonegap. You can transfer this file to your phone and install it.
Check out my next tutorial to build an application which can
access the phones’s native camera.
Peace and cheers!