harmony 鸿蒙@ohos.enterprise.securityManager (Security Management)

  • 2023-10-30
  • 浏览 (353)

@ohos.enterprise.securityManager (Security Management)

The securityManager module provides device security management capabilities, for example, querying the security patch status.

NOTE

  • The initial APIs of this module are supported since API version 11. Newly added APIs will be marked with a superscript to indicate their earliest API version.

  • The APIs of this module can be used only in the stage model.

  • The APIs provided by this module can be called only by a device administrator application that is enabled.

Modules to Import

import securityManager from '@ohos.enterprise.securityManager';

securityManager.getSecurityPatchTag

getSecurityPatchTag(admin: Want): string

Obtains the device security patch tag through the specified device administrator application. This API returns the result synchronously. If the operation is successful, the security patch tag is returned. If the operation fails, an exception is thrown.

Required permissions: ohos.permission.ENTERPRISE_MANAGE_SECURITY

System capability: SystemCapability.Customization.EnterpriseDeviceManager

System API: This is a system API.

Parameters

Name Type Mandatory Description
admin Want Yes Device administrator application.

Return value

Type Description
string Patch tag obtained.

Error codes

For details about the error codes, see Enterprise Device Management Error Codes.

ID Error Message
9200001 the application is not an administrator of the device.
9200002 the administrator application does not have permission to manage the device.

Example

import Want from '@ohos.app.ability.Want';

let wantTemp: Want = {
  bundleName: 'com.example.myapplication',
  abilityName: 'EntryAbility',
};

try {
    let res: string = securityManager.getSecurityPatchTag(wantTemp);
    console.info(`Succeeded in getting security patch tag. tag: ${res}`);
} catch(err) {
    console.error(`Failed to get security patch tag. Code: ${err.code}, message: ${err.message}`);
}

你可能感兴趣的鸿蒙文章

harmony 鸿蒙APIs

harmony 鸿蒙System Common Events (To Be Deprecated Soon)

harmony 鸿蒙System Common Events

harmony 鸿蒙API Reference Document Description

harmony 鸿蒙Enterprise Device Management Overview (for System Applications Only)

harmony 鸿蒙BundleStatusCallback

harmony 鸿蒙@ohos.bundle.innerBundleManager (innerBundleManager)

harmony 鸿蒙@ohos.distributedBundle (Distributed Bundle Management)

harmony 鸿蒙@ohos.bundle (Bundle)

harmony 鸿蒙@ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)

0  赞