• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# MissionSnapshot
2
3The **MissionSnapshot** module defines the snapshot of a mission. The snapshot can be obtained through [getMissionSnapShot](js-apis-app-ability-missionManager.md#missionmanagergetmissionsnapshot).
4
5> **NOTE**
6>
7> 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.
8> The APIs of this module are system APIs and cannot be called by third-party applications.
9
10**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
11
12| Name| Type| Readable| Writable| Description|
13| -------- | -------- | -------- | -------- | -------- |
14| ability | ElementName | Yes| Yes| Ability information of the mission.|
15| snapshot | [image.PixelMap](js-apis-image.md) | Yes| Yes| Snapshot of the mission.|
16
17## How to Use
18
19The mission snapshot information can be obtained by using **getMissionSnapShot** in **missionManager**.
20
21**Example**
22```ts
23import ElementName from '@ohos.bundle';
24import image from '@ohos.multimedia.image';
25import missionManager from '@ohos.application.missionManager';
26
27missionManager.getMissionInfos('', 10, (error, missions) => {
28  console.log('getMissionInfos is called, error.code = ' + error.code);
29  console.log('size = ' + missions.length);
30  console.log('missions = ' + JSON.stringify(missions));
31  let id = missions[0].missionId;
32
33  missionManager.getMissionSnapShot('', id, (error, snapshot) => {
34    console.log('getMissionSnapShot is called, error.code = ' + error.code);
35    console.log('bundleName = ' + snapshot.ability.bundleName);
36  });
37});
38```
39