1e41f4b71Sopenharmony_ci# Setting the Icon and Name of a Mission Snapshot 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ciSetting a unique icon and name for each mission snapshot of an application helps you better manage the missions and functions of the application. 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ciBy default, the **icon** and **label** fields in the [abilities tag](../quick-start/module-configuration-file.md#abilities) of the [module.json5 file](../quick-start/module-configuration-file.md) are used to set the icon and label. 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ciFigure 1 Mission snapshot of a UIAbility 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ciYou can also use [UIAbilityContext.setMissionIcon()](../reference/apis-ability-kit/js-apis-inner-application-uiAbilityContext-sys.md#uiabilitycontextsetmissionicon) and [UIAbilityContext.setMissionLabel()](../reference/apis-ability-kit/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextsetmissionlabel) to customize the icon and name for a mission snapshot. For example, for a UIAbility instance in multiton mode, you can configure the icon and name for each mission snapshot based on different functions. 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ciThis document describes the following operations: 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ci- [Setting a Mission Snapshot Icon (for System Applications Only)](#setting-a-mission-snapshot-icon-for-system-applications-only) 16e41f4b71Sopenharmony_ci- [Setting a Mission Snapshot Name](#setting-a-mission-snapshot-name) 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci## Setting a Mission Snapshot Icon (for System Applications Only) 19e41f4b71Sopenharmony_ci 20e41f4b71Sopenharmony_ciCall [UIAbilityContext.setMissionIcon()](../reference/apis-ability-kit/js-apis-inner-application-uiAbilityContext-sys.md#uiabilitycontextsetmissionicon) to set the icon of a mission snapshot. 21e41f4b71Sopenharmony_ci 22e41f4b71Sopenharmony_ciFor details about how to obtain the context, see [Obtaining the Context of UIAbility](uiability-usage.md#obtaining-the-context-of-uiability). For details about how to obtain the PixelMap information in the example, see [Image Decoding](../media/image/image-decoding.md). 23e41f4b71Sopenharmony_ci 24e41f4b71Sopenharmony_ci```ts 25e41f4b71Sopenharmony_ciimport { common } from '@kit.AbilityKit'; 26e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 27e41f4b71Sopenharmony_ciimport { hilog } from '@kit.PerformanceAnalysisKit'; 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ciconst TAG: string = 'EntryAbility'; 30e41f4b71Sopenharmony_ciconst DOMAIN_NUMBER: number = 0xFF00; 31e41f4b71Sopenharmony_ci 32e41f4b71Sopenharmony_ci// ... 33e41f4b71Sopenharmony_cilet context: common.UIAbilityContext = this.context; // UIAbilityContext 34e41f4b71Sopenharmony_ci 35e41f4b71Sopenharmony_ci// ... // Obtain a pixelMap object. 36e41f4b71Sopenharmony_ci 37e41f4b71Sopenharmony_ci// Set an icon for the mission snapshot. 38e41f4b71Sopenharmony_cicontext.setMissionIcon(pixelMap, (err: BusinessError) => { 39e41f4b71Sopenharmony_ci if (err.code) { 40e41f4b71Sopenharmony_ci hilog.error(DOMAIN_NUMBER, TAG, `Failed to set mission icon. Code is ${err.code}, message is ${err.message}`); 41e41f4b71Sopenharmony_ci } else { 42e41f4b71Sopenharmony_ci hilog.info(DOMAIN_NUMBER, TAG, `Success to set mission icon.`); 43e41f4b71Sopenharmony_ci } 44e41f4b71Sopenharmony_ci}) 45e41f4b71Sopenharmony_ci``` 46e41f4b71Sopenharmony_ci 47e41f4b71Sopenharmony_ciThe display effect is shown below. 48e41f4b71Sopenharmony_ci 49e41f4b71Sopenharmony_ciFigure 2 Mission snapshot icon 50e41f4b71Sopenharmony_ci 51e41f4b71Sopenharmony_ci 52e41f4b71Sopenharmony_ci 53e41f4b71Sopenharmony_ci## Setting a Mission Snapshot Name 54e41f4b71Sopenharmony_ci 55e41f4b71Sopenharmony_ciCall [UIAbilityContext.setMissionLabel()](../reference/apis-ability-kit/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextsetmissionlabel) to set the name of a mission snapshot. 56e41f4b71Sopenharmony_ci 57e41f4b71Sopenharmony_ci```ts 58e41f4b71Sopenharmony_ciimport { common } from '@kit.AbilityKit'; 59e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 60e41f4b71Sopenharmony_ciimport { hilog } from '@kit.PerformanceAnalysisKit'; 61e41f4b71Sopenharmony_ci 62e41f4b71Sopenharmony_ciconst TAG: string = 'EntryAbility'; 63e41f4b71Sopenharmony_ciconst DOMAIN_NUMBER: number = 0xFF00; 64e41f4b71Sopenharmony_ci 65e41f4b71Sopenharmony_ci// ... 66e41f4b71Sopenharmony_cilet context: common.UIAbilityContext = this.context; // UIAbilityContext 67e41f4b71Sopenharmony_ci// Set a name for the mission snapshot. 68e41f4b71Sopenharmony_cicontext.setMissionLabel('test').then(() => { 69e41f4b71Sopenharmony_ci hilog.info(DOMAIN_NUMBER, TAG, 'Succeeded in seting mission label.'); 70e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 71e41f4b71Sopenharmony_ci hilog.error(DOMAIN_NUMBER, TAG, `Failed to set mission label. Code is ${err.code}, message is ${err.message}`); 72e41f4b71Sopenharmony_ci}); 73e41f4b71Sopenharmony_ci``` 74e41f4b71Sopenharmony_ci 75e41f4b71Sopenharmony_ciThe display effect is shown below. 76e41f4b71Sopenharmony_ci 77e41f4b71Sopenharmony_ciFigure 3 Mission snapshot name 78e41f4b71Sopenharmony_ci 79e41f4b71Sopenharmony_ci 80