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.

To use a Cordova plugin:
  1. Clone the git repository of the Cordova plugin on your local disk.
  2. Install the plugin in your Genero GMA/GMI environment.
  3. Identifying the native APIs of the Cordova plugin, to be called with Cordova front calls.
  4. 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

To install a Cordova plugin from Github into your Genero environment, you must:
  1. Clone the Github plugin sources from the Github.
  2. 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:

  1. 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.

  2. 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
  3. 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.

Important: In all cases, after upgrading an FGL, GMI or GMA environment where plugins have been installed, you need to re-execute the plugin installation with a gmabuildtool cordova --install-plugin or gmibuildtool --install-plugin command.

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.

Note: If a plugin with the same name is already installed, it is replaced by the new installation.