Monaca Docs
Search…
Cordova AppVersion Plugin
This Cordova/PhoneGap plugin reads the version of your app from the target build settings.
To check the third party Cordova plugins, you need to create a custom build debugger (Android version or iOS version).

Demo

Enable the plugin in the Monaca IDE

    1.
    From the IDE menu, go to Config → Manage Cordova Plugins .
    2.
    Click the Import Cordova Plugin button. Then, choose to import the plugin using a ZIP file or a URL/package name.

API references

This section describes some of the main functions used in our demo. For complete API references, please refer to the repository.

getAppName()

Get the name of the app.
1
cordova.getAppVersion.getAppName()
Copied!
Return Value
    Promise
Example
1
cordova.getAppVersion.getAppName(function (appName) {
2
alert( appName );
3
});
Copied!

getPackageName()

Get the package name of the app.
1
cordova.getAppVersion.getPackageName()
Copied!
Return Value
    Promise
Example
1
cordova.getAppVersion.getPackageName(function (packName) {
2
alert( packageName );
3
});
Copied!

getVersionCode()

Get the build identifier of the app.
1
cordova.getAppVersion.getVersionCode()
Copied!
Return Value
    Promise
Example
1
cordova.getAppVersion.getVersionCode(function (verCode) {
2
alert( versionCode );
3
});
Copied!

alertVersionNum()

Get the version number of the app.
1
cordova.getAppVersion.alertVersionNum()
Copied!
Return Value
    Promise
Example
1
cordova.getAppVersion.getVersionNumber(function (versionNum) {
2
alert( versionNum );
3
});
Copied!
Last modified 2mo ago