harmony 鸿蒙ProcessRunningInfo

  • 2022-12-22
  • 浏览 (593)

ProcessRunningInfo

The ProcessRunningInfo module defines the running information of a process.

NOTE - The APIs provided by this module are deprecated since API version 9. You are advised to use ProcessInformation9+ instead. - The initial APIs of this module are supported since API version 8.

Modules to Import

import appManager from '@ohos.application.appManager';

Attributes

System capability: SystemCapability.Ability.AbilityRuntime.Mission

Name Type Readable Writable Description
pid number Yes No Process ID.
uid number Yes No User ID.
processName string Yes No Process name.
bundleNames Array<string> Yes No Names of all running bundles in the process.

Usage

The process running information is obtained by using getProcessRunningInfos in appManager.

Example

import appManager from '@ohos.application.appManager';
import { BusinessError } from '@ohos.base';

appManager.getProcessRunningInfos().then((data) => {
    console.log(`success: ${JSON.stringify(data)}`);
}).catch((error: BusinessError) => {
    console.error(`failed: ${JSON.stringify(error)}`);
});

你可能感兴趣的鸿蒙文章

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  赞