const property = new SDK.PluginProperty("integer", "test-property", 0);
See Cordova plugin variables for more information.
The options object uses the following properties.
- The ID of the Cordova plugin to reference.
- version Optional
- A version spec for the Cordova plugin, e.g.
"1.0.4". If this is not specified, the latest version will be used.
- platform Optional
- Specify a specific platform the Cordova plugin applies to. By default this is
"all" meaning it will be used in both Android and iOS exports. However it can be set to
"ios" to only be included when exporting to a specific platform. This is useful to switch between different Cordova plugins on different platforms.
- variables Optional
- Specify variables to be used with the Cordova plugin as an array of
[variableName, pluginProperty] pairs. The variable name is bound to a
SDK.PluginProperty. When the project is exported a variable is added under the plugin reference in config.xml with the given name and a value taken from the specified property. When variables are specified, the
plugin property must also be set.
- plugin Optional
- Used to specify the plugin when using variables. Normally this should be set to
Note for security reasons the Scirra mobile app build service does not allow arbitrary Cordova plugins to be used. The build service uses an allowlist of allowed Cordova plugins. If you'd like a Cordova plugin to be added to the allowlist, please file an issue on the Construct 3 issue tracker. Please note we cannot guarantee that Cordova plugins will be allowed, and approval is subject to a security review. Other build services, such as using PhoneGap Build or compiling with the Cordova CLI, do not impose this restriction.
Remote script dependencies
Plugins and behaviors may also specify remote script dependencies. These are loaded from a cross-origin URL, e.g.
AddRemoteScriptDependency to add a remote URL to load a script from, e.g.:
This will produce the following tag on export, loaded before the runtime: