harmony 鸿蒙@ohos.enterprise.bundleManager(包管理)
@ohos.enterprise.bundleManager(包管理)
本模块提供包管理能力,包括添加包安装白名单、获取包安装白名单、移除包安装白名单等。
说明:
本模块首批接口从API version 12开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
本模块接口仅可在Stage模型下使用。
本模块接口仅对设备管理应用开放,且调用接口前需激活设备管理应用,具体请参考MDM Kit开发指南。
导入模块
import { bundleManager } from '@kit.MDMKit';
bundleManager.addAllowedInstallBundlesSync
addAllowedInstallBundlesSync(admin: Want, appIds: Array<string>, accountId?: number): void
添加应用至应用程序包安装白名单,添加至白名单的应用允许在当前/指定用户下安装,其它非白名单应用不允许安装。
需要权限: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
系统能力: SystemCapability.Customization.EnterpriseDeviceManager
参数:
参数名 | 类型 | 必填 | 说明 |
---|---|---|---|
admin | Want | 是 | 企业设备管理扩展组件。 |
appIds | Array<string> | 是 | 应用ID数组。 |
accountId | number | 否 | 用户ID,取值范围:大于等于0。 accountId可以通过@ohos.account.osAccount中的getOsAccountLocalId等接口来获取。 - 调用接口时,若传入accountId,表示指定用户。 - 调用接口时,若未传入accountId,表示当前用户。 |
错误码:
错误码ID | 错误信息 |
---|---|
9200001 | The application is not an administrator application of the device. |
9200002 | The administrator application does not have permission to manage the device. |
201 | Permission verification failed. The application does not have the permission required to call the API. |
401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
示例:
import { Want } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
let wantTemp: Want = {
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds: Array<string> = ['com.example.******_******/******5t5CoBM='];
try {
bundleManager.addAllowedInstallBundlesSync(wantTemp, appIds, 100);
console.info('Succeeded in adding allowed install bundles.');
} catch (err) {
console.error(`Failed to add allowed install bundles. Code is ${err.code}, message is ${err.message}`);
}
bundleManager.removeAllowedInstallBundlesSync
removeAllowedInstallBundlesSync(admin: Want, appIds: Array<string>, accountId?: number): void
在应用程序包安装白名单中移除应用,在白名单存在的情况下,不在应用程序包安装白名单中的应用不允许在当前/指定用户下安装。
需要权限: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
系统能力: SystemCapability.Customization.EnterpriseDeviceManager
参数:
参数名 | 类型 | 必填 | 说明 |
---|---|---|---|
admin | Want | 是 | 企业设备管理扩展组件。 |
appIds | Array<string> | 是 | 应用ID数组。 |
accountId | number | 否 | 用户ID,取值范围:大于等于0。 accountId可以通过@ohos.account.osAccount中的getOsAccountLocalId等接口来获取。 - 调用接口时,若传入accountId,表示指定用户。 - 调用接口时,若未传入accountId,表示当前用户。 |
错误码:
错误码ID | 错误信息 |
---|---|
9200001 | The application is not an administrator application of the device. |
9200002 | The administrator application does not have permission to manage the device. |
201 | Permission verification failed. The application does not have the permission required to call the API. |
401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
示例:
import { Want } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
let wantTemp: Want = {
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds: Array<string> = ['com.example.******_******/******5t5CoBM='];
try {
bundleManager.removeAllowedInstallBundlesSync(wantTemp, appIds, 100);
console.info('Succeeded in removing allowed install bundles.');
} catch (err) {
console.error(`Failed to remove allowed install bundles. Code is ${err.code}, message is ${err.message}`);
}
bundleManager.getAllowedInstallBundlesSync
getAllowedInstallBundlesSync(admin: Want, accountId?: number): Array<string>
获取当前/指定用户下的应用程序包安装白名单。
需要权限: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
系统能力: SystemCapability.Customization.EnterpriseDeviceManager
参数:
参数名 | 类型 | 必填 | 说明 |
---|---|---|---|
admin | Want | 是 | 企业设备管理扩展组件。 |
accountId | number | 否 | 用户ID,取值范围:大于等于0。 accountId可以通过@ohos.account.osAccount中的getOsAccountLocalId等接口来获取。 - 调用接口时,若传入accountId,表示指定用户。 - 调用接口时,若未传入accountId,表示当前用户。 |
返回值:
类型 | 说明 |
---|---|
Array<string> | 返回当前用户下的应用程序包安装白名单。 |
错误码:
错误码ID | 错误信息 |
---|---|
9200001 | The application is not an administrator application of the device. |
9200002 | The administrator application does not have permission to manage the device. |
201 | Permission verification failed. The application does not have the permission required to call the API. |
401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
示例:
import { Want } from '@kit.AbilityKit';
let wantTemp: Want = {
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
try {
let result: Array<string> = bundleManager.getAllowedInstallBundlesSync(wantTemp, 100);
console.info(`Succeeded in getting allowed install bundles, result : ${JSON.stringify(result)}`);
} catch (err) {
console.error(`Failed to get allowed install bundles. Code is ${err.code}, message is ${err.message}`);
}
bundleManager.addDisallowedInstallBundlesSync
addDisallowedInstallBundlesSync(admin: Want, appIds: Array<string>, accountId?: number): void
添加应用至应用程序包安装黑名单,添加至黑名单的应用不允许在当前/指定用户下安装。
需要权限: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
系统能力: SystemCapability.Customization.EnterpriseDeviceManager
参数:
参数名 | 类型 | 必填 | 说明 |
---|---|---|---|
admin | Want | 是 | 企业设备管理扩展组件。 |
appIds | Array<string> | 是 | 应用ID数组。 |
accountId | number | 否 | 用户ID,取值范围:大于等于0。 accountId可以通过@ohos.account.osAccount中的getOsAccountLocalId等接口来获取。 - 调用接口时,若传入accountId,表示指定用户。 - 调用接口时,若未传入accountId,表示当前用户。 |
错误码:
错误码ID | 错误信息 |
---|---|
9200001 | The application is not an administrator application of the device. |
9200002 | The administrator application does not have permission to manage the device. |
201 | Permission verification failed. The application does not have the permission required to call the API. |
401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
示例:
import { Want } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
let wantTemp: Want = {
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds: Array<string> = ['com.example.******_******/******5t5CoBM='];
try {
bundleManager.addDisallowedInstallBundlesSync(wantTemp, appIds, 100);
console.info('Succeeded in adding disallowed install bundles.');
} catch (err) {
console.error(`Failed to add disallowed install bundles. Code is ${err.code}, message is ${err.message}`);
}
bundleManager.removeDisallowedInstallBundlesSync
removeDisallowedInstallBundlesSync(admin: Want, appIds: Array<string>, accountId?: number): void
在应用程序包安装黑名单中移除应用,在黑名单存在的情况下,在应用程序包安装黑名单中的应用不允许在当前/指定用户下安装。
需要权限: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
系统能力: SystemCapability.Customization.EnterpriseDeviceManager
参数:
参数名 | 类型 | 必填 | 说明 |
---|---|---|---|
admin | Want | 是 | 企业设备管理扩展组件。 |
appIds | Array<string> | 是 | 应用ID数组。 |
accountId | number | 否 | 用户ID,取值范围:大于等于0。 accountId可以通过@ohos.account.osAccount中的getOsAccountLocalId等接口来获取。 - 调用接口时,若传入accountId,表示指定用户。 - 调用接口时,若未传入accountId,表示当前用户。 |
错误码:
错误码ID | 错误信息 |
---|---|
9200001 | The application is not an administrator application of the device. |
9200002 | The administrator application does not have permission to manage the device. |
201 | Permission verification failed. The application does not have the permission required to call the API. |
401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
示例:
import { Want } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
let wantTemp: Want = {
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds: Array<string> = ['com.example.******_******/******5t5CoBM='];
try {
bundleManager.removeDisallowedInstallBundlesSync(wantTemp, appIds, 100)
console.info('Succeeded in removing disallowed install bundles.');
} catch (err) {
console.error(`Failed to remove disallowed install bundles. Code is ${err.code}, message is ${err.message}`);
}
bundleManager.getDisallowedInstallBundlesSync
getDisallowedInstallBundlesSync(admin: Want, accountId?: number): Array<string>
获取当前/指定用户下的应用程序包安装黑名单。
需要权限: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
系统能力: SystemCapability.Customization.EnterpriseDeviceManager
参数:
参数名 | 类型 | 必填 | 说明 |
---|---|---|---|
admin | Want | 是 | 企业设备管理扩展组件。 |
accountId | number | 否 | 用户ID,取值范围:大于等于0。 accountId可以通过@ohos.account.osAccount中的getOsAccountLocalId等接口来获取。 - 调用接口时,若传入accountId,表示指定用户。 - 调用接口时,若未传入accountId,表示当前用户。 |
返回值:
类型 | 说明 |
---|---|
Array<string> | 返回当前用户下的应用程序包安装黑名单。 |
错误码:
错误码ID | 错误信息 |
---|---|
9200001 | The application is not an administrator application of the device. |
9200002 | The administrator application does not have permission to manage the device. |
201 | Permission verification failed. The application does not have the permission required to call the API. |
401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
示例:
import { Want } from '@kit.AbilityKit';
let wantTemp: Want = {
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
try {
let result: Array<string> = bundleManager.getDisallowedInstallBundlesSync(wantTemp, 100);
console.info(`Succeeded in getting disallowed install bundles, result : ${JSON.stringify(result)}`);
} catch (err) {
console.error(`Failed to get disallowed install bundles. Code is ${err.code}, message is ${err.message}`);
}
bundleManager.addDisallowedUninstallBundlesSync
addDisallowedUninstallBundlesSync(admin: Want, appIds: Array<string>, accountId?: number): void
添加应用至包卸载黑名单,添加至黑名单的应用不允许在当前/指定用户下卸载。
需要权限: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
系统能力: SystemCapability.Customization.EnterpriseDeviceManager
参数:
参数名 | 类型 | 必填 | 说明 |
---|---|---|---|
admin | Want | 是 | 企业设备管理扩展组件。 |
appIds | Array<string> | 是 | 应用ID数组。 |
accountId | number | 否 | 用户ID,取值范围:大于等于0。 accountId可以通过@ohos.account.osAccount中的getOsAccountLocalId等接口来获取。 - 调用接口时,若传入accountId,表示指定用户。 - 调用接口时,若未传入accountId,表示当前用户。 |
错误码:
错误码ID | 错误信息 |
---|---|
9200001 | The application is not an administrator application of the device. |
9200002 | The administrator application does not have permission to manage the device. |
201 | Permission verification failed. The application does not have the permission required to call the API. |
401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
示例:
import { Want } from '@kit.AbilityKit';
let wantTemp: Want = {
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds: Array<string> = ['com.example.******_******/******5t5CoBM='];
try {
bundleManager.addDisallowedUninstallBundlesSync(wantTemp, appIds, 100);
console.info('Succeeded in adding disallowed uninstall bundles.');
} catch (err) {
console.error(`Failed to add disallowed uninstall bundles. Code is ${err.code}, message is ${err.message}`);
}
bundleManager.removeDisallowedUninstallBundlesSync
removeDisallowedUninstallBundlesSync(admin: Want, appIds: Array<string>, accountId?: number): void
在包卸载黑名单中移除应用。在黑名单存在的情况下,在包卸载黑名单中的应用不允许在当前/指定用户下卸载。
需要权限: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
系统能力: SystemCapability.Customization.EnterpriseDeviceManager
参数:
参数名 | 类型 | 必填 | 说明 |
---|---|---|---|
admin | Want | 是 | 企业设备管理扩展组件。 |
appIds | Array<string> | 是 | 应用ID数组。 |
accountId | number | 否 | 用户ID,取值范围:大于等于0。 accountId可以通过@ohos.account.osAccount中的getOsAccountLocalId等接口来获取。 - 调用接口时,若传入accountId,表示指定用户。 - 调用接口时,若未传入accountId,表示当前用户。 |
错误码:
错误码ID | 错误信息 |
---|---|
9200001 | The application is not an administrator application of the device. |
9200002 | The administrator application does not have permission to manage the device. |
201 | Permission verification failed. The application does not have the permission required to call the API. |
401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
示例:
import { Want } from '@kit.AbilityKit';
let wantTemp: Want = {
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let appIds: Array<string> = ['com.example.******_******/******5t5CoBM='];
try {
bundleManager.removeDisallowedUninstallBundlesSync(wantTemp, appIds, 100);
console.info('Succeeded in removing disallowed uninstall bundles.');
} catch (err) {
console.error(`Failed to remove disallowed uninstall bundles. Code is ${err.code}, message is ${err.message}`);
}
bundleManager.getDisallowedUninstallBundlesSync
getDisallowedUninstallBundlesSync(admin: Want, accountId?: number): Array<string>
获取当前/指定用户下包卸载黑名单接口。
需要权限: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
系统能力: SystemCapability.Customization.EnterpriseDeviceManager
参数:
参数名 | 类型 | 必填 | 说明 |
---|---|---|---|
admin | Want | 是 | 企业设备管理扩展组件。 |
accountId | number | 否 | 用户ID,取值范围:大于等于0。 accountId可以通过@ohos.account.osAccount中的getOsAccountLocalId等接口来获取。 - 调用接口时,若传入accountId,表示指定用户。 - 调用接口时,若未传入accountId,表示当前用户。 |
返回值:
类型 | 说明 |
---|---|
Array<string> | 返回当前用户下的包卸载黑名单。 |
错误码:
错误码ID | 错误信息 |
---|---|
9200001 | The application is not an administrator application of the device. |
9200002 | The administrator application does not have permission to manage the device. |
201 | Permission verification failed. The application does not have the permission required to call the API. |
401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
示例:
import { Want } from '@kit.AbilityKit';
let wantTemp: Want = {
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
try {
let result: Array<String> = bundleManager.getDisallowedUninstallBundlesSync(wantTemp, 100);
console.info(`Succeeded in getting disallowed uninstall bundles, result : ${JSON.stringify(result)}`);
} catch (err) {
console.error(`Failed to get disallowed uninstall bundles. Code is ${err.code}, message is ${err.message}`);
}
bundleManager.uninstall
uninstall(admin: Want, bundleName: string, userId?: number, isKeepData?: boolean): Promise<void>
卸载当前/指定用户下的指定包接口,选择是否保留包数据(由isKeepData指定)。使用promise异步回调。
需要权限: ohos.permission.ENTERPRISE_INSTALL_BUNDLE
系统能力: SystemCapability.Customization.EnterpriseDeviceManager
参数:
参数名 | 类型 | 必填 | 说明 |
---|---|---|---|
admin | Want | 是 | 企业设备管理扩展组件。 |
bundleName | string | 是 | 包名。 |
userId | number | 否 | 用户ID,取值范围:大于等于0。 - 调用接口时,若传入userId,表示指定用户。 - 调用接口时,若未传入userId,表示当前用户。 |
isKeepData | boolean | 否 | 是否保留包数据,true表示保留,false表示不保留。 |
返回值:
类型 | 说明 |
---|---|
Promise<void> | 无返回结果的Promise对象。当包卸载失败时抛出错误对象。 |
错误码:
错误码ID | 错误信息 |
---|---|
9200001 | The application is not an administrator application of the device. |
9200002 | The administrator application does not have permission to manage the device. |
201 | Permission verification failed. The application does not have the permission required to call the API. |
401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
示例:
import { Want } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
let wantTemp: Want = {
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
bundleManager.uninstall(wantTemp, 'bundleName', 100, true).then(() => {
console.info('Succeeded in uninstalling bundles.');
}).catch((err: BusinessError) => {
console.error(`Failed to uninstall bundles. Code is ${err.code}, message is ${err.message}`);
});
bundleManager.install
install(admin: Want, hapFilePaths: Array<string>, installParam?: InstallParam): Promise<void>
安装指定路径下的应用包。使用promise异步回调。 注意:此接口仅支持安装企业MDM应用。
需要权限: ohos.permission.ENTERPRISE_INSTALL_BUNDLE
系统能力: SystemCapability.Customization.EnterpriseDeviceManager
参数:
参数名 | 类型 | 必填 | 说明 |
---|---|---|---|
admin | Want | 是 | 企业设备管理扩展组件。 |
hapFilePaths | Array<string> | 是 | 待安装应用包路径数组。 |
installParam | InstallParam | 否 | 应用包安装参数。 |
返回值:
类型 | 说明 |
---|---|
Promise<void> | 无返回结果的Promise对象。当应用程序包安装失败时,抛出错误对象。 |
错误码:
错误码ID | 错误信息 |
---|---|
9200001 | The application is not an administrator application of the device. |
9200002 | The administrator application does not have permission to manage the device. |
9201002 | Failed to install the application. |
201 | Permission verification failed. The application does not have the permission required to call the API. |
401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
示例:
import { Want } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
// 为当前用户安装应用
let wantTemp: Want = {
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let hapFilePaths: Array<string> = ['/data/storage/el2/base/haps/entry/testinstall/ExtensionTest.hap'];
bundleManager.install(wantTemp, hapFilePaths).then(() => {
console.info('Succeeded in installing bundles.');
}).catch((err: BusinessError) => {
console.error(`Failed to install bundles. Code is ${err.code}, message is ${err.message}`);
});
import { Want } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
// 为所有用户安装应用
let wantTemp: Want = {
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let hapFilePaths: Array<string> = ['/data/storage/el2/base/haps/entry/testinstall/ExtensionTest.hap'];
const params: Record<string, string> = {
'ohos.bms.param.enterpriseForAllUser': 'true'
};
let installParam: bundleManager.InstallParam = {
userId: 100,
installFlag: 0,
parameters: params
};
bundleManager.install(wantTemp, hapFilePaths, installParam).then(() => {
console.info('Succeeded in installing bundles.');
}).catch((err: BusinessError) => {
console.error(`Failed to install bundles. Code is ${err.code}, message is ${err.message}`);
});
bundleManager.getInstalledBundleList20+
getInstalledBundleList(admin: Want, accountId: number): Promise<Array<BundleInfo>>
获取设备指定用户下已安装应用列表。使用Promise异步回调。
需要权限: ohos.permission.ENTERPRISE_GET_ALL_BUNDLE_INFO
系统能力: SystemCapability.Customization.EnterpriseDeviceManager
参数:
参数名 | 类型 | 必填 | 说明 |
---|---|---|---|
admin | Want | 是 | 企业设备管理扩展组件。 |
accountId | number | 是 | 用户ID,取值为正整数,取值范围:大于等于0。 accountId可以通过@ohos.account.osAccount中的getOsAccountLocalId等接口来获取。 |
返回值:
类型 | 说明 |
---|---|
Promise<Array<BundleInfo> | Promise对象,返回已安装应用包信息。 |
错误码:
错误码ID | 错误信息 |
---|---|
9200001 | The application is not an administrator application of the device. |
9200002 | The administrator application does not have permission to manage the device. |
201 | Permission verification failed. The application does not have the permission required to call the API. |
示例:
import { Want } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
import { bundleManager } from '@kit.MDMKit';
let wantTemp: Want = {
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
};
let accountId: number = 100;
bundleManager.getInstalledBundleList(wantTemp, accountId).then((result) => {
console.info('Succeeded in getting installed bundle list.');
}).catch((err: BusinessError) => {
console.error(`Failed to get installed bundle list. Code is ${err.code}, message is ${err.message}`);
});
InstallParam
应用包安装需指定的参数信息。
系统能力: SystemCapability.Customization.EnterpriseDeviceManager
名称 | 类型 | 必填 | 说明 |
---|---|---|---|
userId | number | 否 | 指示用户id,默认值:调用方所在用户,取值范围:大于等于0。 |
installFlag | number | 否 | 安装标志。枚举值:0:应用初次安装,1:应用覆盖安装,2:应用免安装,默认值为应用初次安装。 |
parameters19+ | Record<string, string> | 否 | 扩展参数,默认值为空。key取值支持”ohos.bms.param.enterpriseForAllUser”,若对应的value值为”true”,表示为所有用户安装应用。 |
BundleInfo20+
描述应用包信息。
系统能力: SystemCapability.Customization.EnterpriseDeviceManager
名称 | 类型 | 只读 | 可选 | 说明 |
---|---|---|---|---|
name | string | 是 | 否 | 应用包的名称,对应app.json5中配置的bundleName字段。 |
vendor | string | 是 | 否 | 应用包的供应商,对应app.json5中配置的vendor字段。 |
versionCode | number | 是 | 否 | 应用包的版本号,对应app.json5中配置的versionCode字段。 |
versionName | string | 是 | 否 | 应用包的版本文本描述信息,对应app.json5中配置的versionName字段。 |
minCompatibleVersionCode | number | 是 | 否 | 分布式场景下的应用包兼容的最低版本,对应app.json5中配置的minCompatibleVersionCode字段。 |
targetVersion | number | 是 | 否 | 应用运行目标版本,对应app.json5中配置的targetAPIVersion字段。 |
appInfo | ApplicationInfo | 是 | 否 | 应用程序信息,包括应用程序名称、应用程序的安装目录等。 |
signatureInfo | SignatureInfo | 是 | 否 | 应用包的签名信息。 |
installTime | number | 是 | 否 | 应用包安装时间戳,表示从1970-01-01 08:00:00 UTC+8逝去的毫秒数,单位毫秒。 |
updateTime | number | 是 | 否 | 应用包更新时间戳,表示从1970-01-01 08:00:00 UTC+8逝去的毫秒数,单位毫秒。 |
appIndex | number | 是 | 否 | 应用包的分身索引标识,仅在分身应用中生效。 |
firstInstallTime | number | 是 | 是 | 应用在当前设备的首次安装时间戳,表示从1970-01-01 08:00:00 UTC+8逝去的毫秒数,单位毫秒,预置应用的首次安装时间戳为1533657660000。 |
SignatureInfo20+
描述应用包的签名信息。
系统能力: SystemCapability.Customization.EnterpriseDeviceManager
名称 | 类型 | 只读 | 可选 | 说明 |
---|---|---|---|---|
appId | string | 是 | 否 | 应用的appId。 |
fingerprint | string | 是 | 否 | 应用包的指纹信息。使用的签名证书发生变化,该字段会发生变化。 |
appIdentifier | string | 是 | 否 | 应用的唯一标识,是AppGallery Connect创建应用时分配的APP ID,为云端统一分配的随机字符串。该ID在应用全生命周期中不会发生变化,包括版本升级、证书变更、开发者公私钥变更、应用转移等。 |
certificate | string | 是 | 是 | 应用的证书公钥。 |
ApplicationInfo20+
应用程序信息。
系统能力: SystemCapability.Customization.EnterpriseDeviceManager
名称 | 类型 | 只读 | 可选 | 说明 |
---|---|---|---|---|
name | string | 是 | 否 | 应用的Bundle名称。 |
description | string | 是 | 否 | 应用的描述信息,使用示例:"description": $string: mainability_description" 。关于description的详细信息可参见descriptionResource字段说明。 |
descriptionId | number | 是 | 否 | 应用的描述信息的资源id。 |
enabled | boolean | 是 | 否 | 判断应用程序是否可以使用,true表示可以使用,false表示不可使用。 |
label | string | 是 | 否 | 应用的名称,使用示例:"label": "$string: mainability_description" 。关于label的详细信息可参见labelResource字段说明。 |
labelId | number | 是 | 否 | 应用名称的资源id。 |
icon | string | 是 | 否 | 应用程序的图标,使用示例:"icon": "$media:icon" 。关于icon的详细信息可参见iconResource字段说明。 |
iconId | number | 是 | 否 | 应用程序图标的资源id。 |
process | string | 是 | 否 | 应用程序的进程名称。 |
codePath | string | 是 | 否 | 应用程序的安装目录。 |
removable | boolean | 是 | 否 | 应用程序是否可以被移除,true表示可以被移除,false表示不可以被移除。 |
accessTokenId | number | 是 | 否 | 应用程序的accessTokenId。 |
uid | number | 是 | 否 | 应用程序的Uid。 |
iconResource | Resource | 是 | 否 | 应用程序的图标资源信息,包含了该资源的信息的bundleName、moduleName和id。 |
labelResource | Resource | 是 | 否 | 应用程序的标签资源信息,包含了该资源的信息的bundleName、moduleName和id。 |
descriptionResource | Resource | 是 | 否 | 应用程序的描述资源信息,包含了该资源的信息的bundleName、moduleName和id。 |
appDistributionType | string | 是 | 否 | 应用程序签名证书的分发类型,分为: - app_gallery:应用市场分发的应用。 - enterprise:企业应用,可以安装到个人设备上。 - enterprise_mdm:企业MDM应用,只能安装在企业设备上。需要设备管理特权,比如远程锁定,安装普通企业应用等。 - enterprise_normal:普通企业应用,只能通过企业MDM应用安装在企业设备上。无需设备管理特权。 - os_integration:系统预置应用。 - crowdtesting:众包测试应用。 - internaltesting:应用市场内测的应用。 - none:其他。 |
appProvisionType | string | 是 | 否 | 应用程序签名证书文件的类型,支持的取值如下: - debug:调试类型。 - release:发布类型。 |
systemApp | boolean | 是 | 否 | 应用是否为系统应用,true表示系统应用,false表示非系统应用。 |
debug | boolean | 是 | 否 | 标识应用是否处于调试模式,true表示应用处于调试模式,false表示应用处于非调试模式。 |
dataUnclearable | boolean | 是 | 否 | 标识应用数据是否可被删除。true表示不可删除,false表示可以删除。 |
nativeLibraryPath | string | 是 | 否 | 应用程序的本地库文件路径。 |
appIndex | number | 是 | 否 | 应用包的分身索引标识,仅在分身应用中生效。 |
installSource | string | 是 | 否 | 应用程序的安装来源,支持的取值如下: - pre-installed表示应用为第一次开机时安装的预置应用。 - ota表示应用为系统升级时新增的预置应用。 - recovery表示卸载后再恢复的预置应用。 - bundleName表示应用由此包名对应的应用安装。 - unknown表示应用安装来源未知。 |
releaseType | string | 是 | 否 | 标识应用打包时使用的SDK的发布类型。当前SDK的发布类型可能为Canary、Beta、Release,其中Canary和Beta可能通过序号进一步细分,例如Canary1、Canary2、Beta1、Beta2等。开发者可通过对比应用打包依赖的SDK发布类型和OS的发布类型(deviceInfo.distributionOSReleaseType)来判断兼容性。 |
Resource20+
资源相关信息,包括应用包名、应用模块名、资源id。
系统能力: SystemCapability.Customization.EnterpriseDeviceManager
名称 | 类型 | 只读 | 可选 | 说明 |
---|---|---|---|---|
bundleName | string | 否 | 否 | 应用的bundle名称。 |
moduleName | string | 否 | 否 | 应用的module名称。 |
id | number | 否 | 否 | 资源的id值。 |
你可能感兴趣的鸿蒙文章
harmony 鸿蒙@ohos.enterprise.EnterpriseAdminExtensionAbility(企业设备管理扩展能力)
harmony 鸿蒙@ohos.enterprise.accountManager(账户管理)(系统接口)
harmony 鸿蒙@ohos.enterprise.accountManager(账户管理)
harmony 鸿蒙@ohos.enterprise.adminManager(企业设备管理)(系统接口)
harmony 鸿蒙@ohos.enterprise.adminManager (admin权限管理)
harmony 鸿蒙@ohos.enterprise.applicationManager(应用管理)(系统接口)
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦