1# MissionSnapshot (System API)
2
3The **MissionSnapshot** module defines the snapshot of a mission. The snapshot can be obtained through [missionManager.getMissionSnapShot](js-apis-app-ability-missionManager-sys.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## Modules to Import
11
12```ts
13import { missionManager } from '@kit.AbilityKit';
14```
15
16## Attributes
17
18**System API**: This is a system API.
19
20**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
21
22| Name | Type | Readable | Writable | Description |
23| -------- | -------- | -------- | -------- | -------- |
24| ability | ElementName | Yes | Yes | Ability information of the mission. |
25| snapshot | [PixelMap](../apis-image-kit/js-apis-image.md#pixelmap7) | Yes | Yes | Snapshot of the mission. |
26
27## How to Use
28
29The mission snapshot information can be obtained by using **getMissionSnapShot** in **missionManager**.
30
31**Example**
32```ts
33import { missionManager } from '@kit.AbilityKit';
34import { BusinessError } from '@kit.BasicServicesKit';
35
36try {
37  missionManager.getMissionInfos('', 10, (error, missions) => {
38    if (error) {
39      console.error(`getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}`);
40      return;
41    }
42    console.log(`size = ${missions.length}`);
43    console.log(`missions = ${JSON.stringify(missions)}`);
44    let id = missions[0].missionId;
45
46    missionManager.getMissionSnapShot('', id, (err, snapshot) => {
47      if (err) {
48        console.error(`getMissionInfos failed, err.code: ${JSON.stringify(err.code)}, err.message: ${JSON.stringify(err.message)}`);
49        return;
50      }
51      // Carry out normal service processing.
52      console.log(`bundleName = ${snapshot.ability.bundleName}`);
53    });
54  });
55} catch (paramError) {
56  console.error(`error: ${(paramError as BusinessError).code}, ${(paramError as BusinessError).message}`);
57}
58```
59