Cordova AppVersion Plugin

This Cordova/PhoneGap plugin reads the version of your app from the target build settings.

Demo

Enable the Plugin in Monaca IDE

  1. From the IDE menu, go to Config → Manage Cordova Plugins .

  2. Click on Import Cordova Plugin button. Then, you can choose to import the plugin using a ZIP file or URL/Package Name.

API References

In this page, we only describe some main APIs used in our Demo. For a complete API references, please refer to here.

getAppName()

Get the name of the app.

cordova.getAppVersion.getAppName()

Return Value

  • Promise

Example

cordova.getAppVersion.getAppName(function (appName) {
    alert( appName );
});

getPackageName()

Get the package name of the app.

cordova.getAppVersion.getPackageName()

Return Value

  • Promise

Example

cordova.getAppVersion.getPackageName(function (packName) {
    alert( packageName );
});

getVersionCode()

Get the build identifier of the app.

cordova.getAppVersion.getVersionCode()

Return Value

  • Promise

Example

cordova.getAppVersion.getVersionCode(function (verCode) {
    alert( versionCode );
});

alertVersionNum()

Get the version number of the app.

cordova.getAppVersion.alertVersionNum()

Return Value

  • Promise

Example

cordova.getAppVersion.getVersionNumber(function (versionNum) {
    alert( versionNum );
});