Cordova and PhoneGap to an application developer
PhoneGap supports wide variety of platforms:
- Windows 8
- Windows Phone 7 & 8
- BlackBerry 5.x +
PhoneGap comes with a complete set of device capabilities like camera, contacts, filesystem, media playback and recording, etc. If the capabilities aren't enough PhoneGap allows the developer to access more features by developing new plugins or installing already developed plugins like a Bluetooth plugin, barcode scanning plugin, push notifications, etc. Some command-line tools are also provided to make it easy to add the plugins to the repository for your project.
The command-line tools are based on Node.js; thus, you must install it before installing PhoneGap.
To install Cordova command line tools:
Download and install Node.js. Also download and install git-client since the CLI does use it behind-the-scenes to download some of the assets when creating a new project.
Once Node.js is in place, simply run one command for the node package manager to install PhoneGap’s tools:
Creating an App Using PhoneGap
The below commands needs to be run on Node.js
The first argument hello specifies a directory to be generated for your project. This directory should not exist, Cordova will generate it. The www subdirectory houses the application's home page, along with various resources under css, js, and img. The config.xml file contains important metadata needed to generate and distribute the application.
The second argument com.example.hello provides your project with a reverse domain-style identifier. This argument is optional, but only if you also omit the third argument, since the arguments are positional. You can edit this values in config.xml , but since the values are referred do be aware that there may be code generated based on config.xml. The default value is io.cordova.hellocordova, but it is recommended that you select an appropriate value.
The third argument HelloWorld provides the application's display title. This argument is optional. You can edit this value later in the config.xml file, but do be aware that there may be code generated outside of config.xml using this value. The default value is HelloCordova, but it is recommended that you select an appropriate value.
Developers can use an IDE like Android Studio for application development on the Android platform which is well supported by PhoneGap.
There are also other Bluetooth plugins available for PhoneGap such as:
- Bluetooth Serial
- Bluetooth LE