Understanding Cordova plugins
Cordova plugins allow you to access specific mobile device functionalities.
What are Cordova plugins in Genero?
Cordova plugins are based on the Apache Cordova cross-platform mobile development framework, to access mobile device functionality such as the accelerometer, the camera, the compass, the microphone, and more.
GMI and GMA act as a plugin container and provide a plugin API widely compatible with the original Cordova API. The implementation is Genero-specific and makes the native plugin interfaces available in Genero BDL.
Cordova plugins with device simulator or in client/server GUI mode
Depending on the configuration used when executing your app, some Cordova plugins or plugin APIs may not be available and may cause a malfunction.
- When using a device simulator, some Cordova plugin will not work because the feature is not available on the simulator.
- When executing the app on a server in development mode or in "runOnServer" mode, the front calls are slowed down by the network roundtrips.
Installing Cordova plugins into the development environment
In order to be used, Cordova plugins have to be downloaded from the FOURJS Cordova
Github or from the Apache Cordova Github, and must be installed by using the
--install-plugin
option of GMA or GMI build tools.
For more details, see Installing Cordova plugins.
Building apps with Cordova plugins
Installed Cordova plugins need to be specified in the build process when creating your app.
--cordova-plugin
option of GMA and GMI build tools:
Using Cordova plugin APIs
Access to the native code can be achieved using native Cordova APIs through Cordova plugin front calls.
However, it is more convenient to have BDL wrappers on top of these front calls. Most Cordova plugins provided by FOURJS are shipped with a BDL wrapper library, available from the FOURJS Cordova Github.