harmony 鸿蒙MissionInfo

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

MissionInfo

The MissionInfo module defines detailed information about a mission. The information can be obtained through getMissionInfo.

NOTE

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

Modules to Import

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

Attributes

System capability: SystemCapability.Ability.AbilityRuntime.Mission

System API: This is a system API and cannot be called by third-party applications.

Name Type Readable Writable Description
missionId number Yes Yes Mission ID.
runningState number Yes Yes Running state of the mission.
lockedState boolean Yes Yes Locked state of the mission.
timestamp string Yes Yes Latest time when the mission was created or updated.
want Want Yes Yes Want information of the mission.
label string Yes Yes Label of the mission.
iconPath string Yes Yes Path of the mission icon.
continuable boolean Yes Yes Whether the mission can be continued on another device.
abilityState10+ number Yes Yes Capability status of the mission.
unclearable10+ boolean Yes Yes Whether the mission can be manually deleted.

Example

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

try {
  missionManager.getMissionInfo('', 1, (error, data) => {
    if (error) {
        // Process service logic errors.
        console.error(`getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}`);
        return;
    }

    console.log(`getMissionInfo missionId is: ${JSON.stringify(data.missionId)}`);
    console.log(`getMissionInfo runningState is: ${JSON.stringify(data.runningState)}`);
    console.log(`getMissionInfo lockedState is: ${JSON.stringify(data.lockedState)}`);
    console.log(`getMissionInfo timestamp is: ${JSON.stringify(data.timestamp)}`);
    console.log(`getMissionInfo want is: ${JSON.stringify(data.want)}`);
    console.log(`getMissionInfo label is: ${JSON.stringify(data.label)}`);
    console.log(`getMissionInfo iconPath is: ${JSON.stringify(data.iconPath)}`);
    console.log(`getMissionInfo continuable is: ${JSON.stringify(data.continuable)}`);
    console.log(`getMissionInfo unclearable is: ${JSON.stringify(data.unclearable)}`);
    });
} catch (paramError) {
    console.error(`error: ${paramError.code}, ${paramError.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  赞