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