Installing Cordova plugins
Before usage, Cordova plugins need to be installed in the GMA or GMI development environment.
Using Cordova plugins from the GitHub
GitHub contains a large number of Cordova plugins that can be used in your app, like those from the Apache Github for example, or the FOURJS Cordova Github.
- Clone the git repository of the Cordova plugin on your local disk.
- Install the plugin in your Genero GMA/GMI environment.
- Identifying the native APIs of the Cordova plugin, to be called with Cordova front calls.
- Implement BDL wrappers to encapsulate the Cordova front calls specific to this plugin, or use the BDL wrappers available with the plugins available on the FOURJS Cordova Github.
Prerequisites
Cordova plugins are available on a Github repository. The git command line tool is required to clone the repository on your local disk.
Installing Cordova plugins
- Clone the Github plugin sources from the Github.
- Install the plugin in the Genero development environment with the gmibuildtool or gmabuildtool
--install-plugins
command line option.
For example, to install the Apache "cordova-plugin-network-information"
plugin:
- Clone the Git repository into a local
directory:
$ cd /tmp $ git clone https://github.com/apache/cordova-plugin-network-information.git
The plugin is now in the /tmp/cordova-plugin-network-information directory.
- Install the plugin with the GMA or GMI build tool:
-
For GMI / iOS:
$ gmibuildtool --install-plugins=/tmp/cordova-plugin-network-information ... (wrapper and installation information is displayed)
The
gmibuildtool --list-plugins
command now lists the new plugin in addition to the existing ones. -
For GMA / Android (note that you need to use the "scaffold" command!):
$ gmabuildtool scaffold --install-plugins /tmp/cordova-plugin-network-information
-
- Check that the plugin is properly installed with the
--list-plugins
option of the build tool:-
For GMI / iOS:
$ gmibuildtool --list-plugins ... cordova-plugin-network-information ...
-
For GMA / Android:
$ gmabuildtool scaffold --list-plugins ... cordova-plugin-network-information ...
-
The cordova-plugin-network-information
name can now be used for bundling an
application using that plugin.
Upgrading GMI (FGL) or GMA with installed Cordova plugins
Cordova plugins need to be re-installed, after upgrading the GMI package (GMIDIR) or GMA package (GMADIR), or the FGL package if GMI is installed in FGLDIR.
- The GMI package can be installed into the FGLDIR installation directory, or in a separate GMIDIR installation directory.
- The GMA package is always installed in a GMADIR installation directory.
Checking out a particular version from GitHub
If you want to test a particular version of a plugin, you need to check out that version from GitHub before installing.
$ cd cordova-plugin-network-information $ git checkout <superversion> $ cd -
Then use the gmibuildtool or gmabuildtool to build with the super version.