This plugin defines a global BuildInfo object.
BuildInfo object is available at the time the deviceready event fires.
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
console.log('BuildInfo.packageName =' + BuildInfo.packageName);
console.log('BuildInfo.basePackageName=' + BuildInfo.basePackageName);
console.log('BuildInfo.displayName =' + BuildInfo.displayName);
console.log('BuildInfo.name =' + BuildInfo.name);
console.log('BuildInfo.version =' + BuildInfo.version);
console.log('BuildInfo.versionCode =' + BuildInfo.versionCode);
console.log('BuildInfo.debug =' + BuildInfo.debug);
console.log('BuildInfo.buildType =' + BuildInfo.buildType);
console.log('BuildInfo.flavor =' + BuildInfo.flavor);
}
cordova plugin add cordova-plugin-buildinfo
- Android
- iOS
BuildInfo.packageName
BuildInfo.basePackageName
BuildInfo.displayName
BuildInfo.name
BuildInfo.version
BuildInfo.versionCode
BuildInfo.debug
BuildInfo.buildType
BuildInfo.flavor
Get the packageName of Application ID.
Platform | Value | Type |
---|---|---|
Android | Package Name | String |
iOS | Bundle Identifier | String |
Android only.
Get the packageName of BuildConfig class.
If you use the configure of "build types" or "product flavors", because you can specify a different package name is the id attribute of the widget element of config.xml, is the property to get the package name that BuildConfig class belongs. (ought be the same as the id attribute of the widget element of config.xml)
Platform | Value | Type |
---|---|---|
Android | Package name of BuildConfig class | String |
iOS | Bundle Identifier(equals BuildInfo.packageName) | String |
Get the displayName.
Platform | Value | Type |
---|---|---|
Android | Application Label | String |
iOS | CFBundleDisplayName | String |
Get the name.
Platform | Value | Type |
---|---|---|
Android | Application Label(equal BuildInfo.displayName) | String |
iOS | CFBundleName | String |
Get the version.
Platform | Value | Type |
---|---|---|
Android | BuildConfig.VERSION_NAME | String |
iOS | CFBundleShortVersionString | String |
Get the version code.
Platform | Value | Type |
---|---|---|
Android | BuildConfig.VERSION_CODE | int |
iOS | CFBundleVersion | string |
Get the debug flag.
Platform | Value | Type |
---|---|---|
Android | BuildConfig.DEBUG | Boolean |
iOS | defined "DEBUG" is true | Boolean |
Android Only.
Get the build type.
Platform | Value | Type |
---|---|---|
Android | BuildConfig.BUILD_TYPE | String |
iOS | empty string | String |
Android Only.
Get the flavor.
Platform | Value | Type |
---|---|---|
Android | BuildConfig.FLAVOR | String |
iOS | empty string | String |