harmony 鸿蒙ExtensionRunningInfo
ExtensionRunningInfo
The ExtensionRunningInfo module encapsulates ExtensionAbility running information, which can be obtained through getExtensionRunningInfos.
NOTE
- The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
- This module is marked as @systemapi and not visible to third-party applications.
Modules to Import
import abilityManager from '@ohos.app.ability.abilityManager';
Usage
Import the abilityManager module and obtain the ExtensionAbility running information by calling the method in the abilityManager module.
Attributes
System capability: SystemCapability.Ability.AbilityRuntime.Core
System API: The following APIs are system APIs and cannot be called by third-party applications.
Name | Type | Readable | Writable | Description |
---|---|---|---|---|
extension | ElementName | Yes | No | ExtensionAbility information. |
pid | number | Yes | No | Process ID. |
uid | number | Yes | No | UID of the application. |
processName | string | Yes | No | Process name. |
startTime | number | Yes | No | Timestamp when the ExtensionAbility is started. |
clientPackage | Array<String> | Yes | No | Names of all packages in the process. |
type | ExtensionAbilityType | Yes | No | ExtensionAbility type. |
Example
import abilityManager from '@ohos.app.ability.abilityManager';
let upperLimit = 1;
function getExtensionInfos() {
abilityManager.getExtensionRunningInfos(upperLimit, (error, data) => {
if (error) {
console.error(`getForegroundApplications failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}`);
return;
}
for (let i = 0; i < data.length; i++) {
let extensionRunningInfo = data[i];
console.log(`extensionRunningInfo.extension: ${JSON.stringify(extensionRunningInfo.extension)}`);
console.log(`extensionRunningInfo.pid: ${JSON.stringify(extensionRunningInfo.pid)}`);
console.log(`extensionRunningInfo.uid: ${JSON.stringify(extensionRunningInfo.uid)}`);
console.log(`extensionRunningInfo.processName: ${JSON.stringify(extensionRunningInfo.processName)}`);
console.log(`extensionRunningInfo.startTime: ${JSON.stringify(extensionRunningInfo.startTime)}`);
console.log(`extensionRunningInfo.clientPackage: ${JSON.stringify(extensionRunningInfo.clientPackage)}`);
console.log(`extensionRunningInfo.type: ${JSON.stringify(extensionRunningInfo.type)}`);
}
});
}
你可能感兴趣的鸿蒙文章
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)
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦