
Install and initialize phonegap service under Windows
This section will explain everything necessary for the development of a mobile application through the phone in Windows / Android operating systems.
To understand everything, first you have to ask yourself, What is Phonegap?
Phonegap allows you to package HTML5 applications in a way that can be used as mobile applications or web applications.
PhoneGap allows us to carry out the development for the web in the world of mobile devices. They allow us to run applications developed with HTML, CSS and Javascript as well as native applications for mobile phones or tablets. The applications that we can develop with PhoneGap can be published in the app stores as (Google Play, Windows Store or App Store) and, like native applications, they are also able to access the peripherals of devices such as the camera.
Installation of phonegap in windows operating systems
The necessary components to implement an Android application with the phone packages in Windows will be listed.
1. Android Studio that considers the Android SDK (Go to page)
2. Node.js (Go to page)
3. JDK (Go to page)
4. Apache Ant (Go to page)
Steps to lift the work environment
1. Install and set the environment variable of the JDK.
Once the JDK is installed you must set the two variables, JAVA_HOME and in PATH
In JAVA_HOME the path of the folder where the JDK is installed is assigned. Example (C:\Program Files\Java\jdk1.8.0_91)
In PATH, the path of the folder where the JDK was installed is assigned. Example (C:\Program Files\Java\jdk1.8.0_91\ bin)
2. Install Android Studio, you must assign the environment variables for tools-platform tools and tools
Once installed, you must set the platform-tool environment variables and tools of the Android Studio SDK, with this we have the functions of the ADB.
You must also set the ANDROID_HOME variable of it to point to the SDK directory. Example (C:\Users\ user_example\AppData\Local\Android\sdk)
The tools and platform tools are set in the environment variable.
Example (C:\Users\user_example\AppData\Local\Android\sdk\platform-tools)
Example (C:\Users\user_example\AppData\Local\Android\sdk\tools)
3. Install Node.js and set the environment variable
Once I installed the Node.js, I set the PATH environment variable to the node.js path (C:\Program Files\ nodejs)
By installing this, it allows us to execute the npm command which will be used to download and install phonegap
4. Download the apache and the environment variable ANT_HOME
Once the file is downloaded, unzip
Set the variable ANT_HOME the path of the folder ant. Example (C:\apache-ant-1.9.7)
Set the ant / bin path in the PATH variable. Example (C:\apache-ant-1.9.7 / bin)
It is a Java library that allows to manage the processes in the construction of files.
5. Install Phonegap
Run the command npm install -g phonegap
If you give error messages, run the cmd as administrator.
Observations: Once the environment variables have been set, for the effect to arise, the computer must be restarted.
How does Phonegap work?
Phonegap allows you to connect a mobile device with our web application through two main components:
Webview
Accessories
Webview
It is basically an instance of the mobile device's browser.
It does not have a user interface, but it does have the rendering and javascript engines.
Accessories
A Phonegap plugin is the bridge between the web application and the mobile device.
It consists of two parts: the native implementation and the Javascript implementation.