This plugin reads the version of your app that you put in config.xml and makes it available inside your app via Javascript.
This plugin should work on any platform since it does not rely on any native code.
- 0.2.7
- Added support for
cordova@>9.0.0
. Thanks to @lyudmil
- Added support for
- 0.2.6
- switched from plain
fs
toq-io
for better promise handling - fixed error under
cordova@>5.0.0
when adding platform and expected directory structure does not exist
- switched from plain
- 0.2.2
- updated
before_prepare
hook to work withcordova@>5.0.0
- updated
- 0.1.0
- Added namespace
version
to not override other plugins see issue 2
Call to retrieve the appVersion is now:window.cordova.plugins.version.getAppVersion()
- Added namespace
- 0.0.4
- Changed directory separators from
\\
to/
see issue 1
- Changed directory separators from
npm install q-io
cordova plugin add cordova_app_version_plugin
The plugin will then be accessable via window.cordova.plugins.version.getAppVersion()
.
<?xml version='1.0' encoding='utf-8'?>
<widget id="my.app.id" version="1.5.0">...</widget>
A call window.cordova.plugins.version.getAppVersion()
will return the version "1.5.0"
.
The plugins uses the before_prepare
hook to generate the getAppVersion.js
file which will be added to the App on build. The getAppVersion.js
file which comes with the plugin is just a placeholder, as it should be available when the plugin is installed.
Since getAppVersion.js
is regenerated on every build, you should not add it under version control!