@ccervantesb/cordova-plugin-application-info
v1.0.2
Published
This plugin allows get the application information from the app.
Downloads
4
Maintainers
Readme
cordova-plugin-application-info
This plugin allows get the application information from the app.
Installation
Install plugin from npm:
npm i @ccervantesb/cordova-plugin-application-infoOr install the latest master version from GitHub:
cordova plugin add https://github.com/cesarcervantesb/cordova-plugin-application-infoSupported Platforms
- Android
- iOS
Usage
The plugin creates the object cordova.plugins.appInfo and is accessible after the deviceready event has been fired.
document.addEventListener('deviceready', function () {
// cordova.plugins.appInfo is now available
}, false);Available methods
getApplicationInfo- Get application information.
appInfo.getApplicationInfo();OR
cordova.plugins.appInfo.getApplicationInfo();Return a JSON Object that contains the application information:
- appName
- packageName
- versionName
- versionCode
Example
appInfo.getApplicationInfo(function (appInfo){
// Success callback
console.log("appName:" + appInfo.appName);
console.log("packageName:" + appInfo.packageName);
console.log("versionName:" + appInfo.versionName);
console.log("versionCode:" + appInfo.versionCode);
}, function (error) {
// Error callback
console.log(error);
});