1e41f4b71Sopenharmony_ci# @ohos.app.ability.AtomicServiceOptions (AtomicServiceOptions) 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci**AtomicServiceOptions** is used as an input parameter of [openAtomicService()](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextopenatomicservice12) to carry arguments. It inherits from [StartOptions](js-apis-app-ability-startOptions.md). 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci> **NOTE** 6e41f4b71Sopenharmony_ci> 7e41f4b71Sopenharmony_ci> The initial APIs of this module are supported since API version 12. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8e41f4b71Sopenharmony_ci> 9e41f4b71Sopenharmony_ci> The APIs of this module can be used only in the stage model. 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci## Modules to Import 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ci```ts 14e41f4b71Sopenharmony_ciimport { AtomicServiceOptions } from '@kit.AbilityKit'; 15e41f4b71Sopenharmony_ci``` 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci## Properties 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Ability.AbilityRuntime.Core 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ci| Name| Type| Read Only| Optional| Description| 24e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- | 25e41f4b71Sopenharmony_ci| [flags](js-apis-app-ability-wantConstant.md#flags) | number | No| Yes| Mode in which the system processes the startup.<br>For example, **wantConstant.Flags.FLAG_INSTALL_ON_DEMAND** indicates that the installation-free capability is used.| 26e41f4b71Sopenharmony_ci| parameters | Record\<string, Object> | No| Yes| Additional parameters. For details, see the **parameters** field in [Want](js-apis-app-ability-want.md).| 27e41f4b71Sopenharmony_ci 28e41f4b71Sopenharmony_ci**Example** 29e41f4b71Sopenharmony_ci 30e41f4b71Sopenharmony_ci```ts 31e41f4b71Sopenharmony_ciimport { UIAbility, AtomicServiceOptions, common, wantConstant } from '@kit.AbilityKit'; 32e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 33e41f4b71Sopenharmony_ci 34e41f4b71Sopenharmony_ciexport default class EntryAbility extends UIAbility { 35e41f4b71Sopenharmony_ci onForeground() { 36e41f4b71Sopenharmony_ci let appId: string = '6918661953712445909'; 37e41f4b71Sopenharmony_ci let options: AtomicServiceOptions = { 38e41f4b71Sopenharmony_ci flags: wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, 39e41f4b71Sopenharmony_ci parameters: { 40e41f4b71Sopenharmony_ci "demo.result": 123456 41e41f4b71Sopenharmony_ci } 42e41f4b71Sopenharmony_ci }; 43e41f4b71Sopenharmony_ci 44e41f4b71Sopenharmony_ci try { 45e41f4b71Sopenharmony_ci this.context.openAtomicService(appId, options) 46e41f4b71Sopenharmony_ci .then((result: common.AbilityResult) => { 47e41f4b71Sopenharmony_ci // Carry out normal service processing. 48e41f4b71Sopenharmony_ci console.info('openAtomicService succeed'); 49e41f4b71Sopenharmony_ci }) 50e41f4b71Sopenharmony_ci .catch((err: BusinessError) => { 51e41f4b71Sopenharmony_ci // Process service logic errors. 52e41f4b71Sopenharmony_ci console.error(`openAtomicService failed, code is ${err.code}, message is ${err.message}`); 53e41f4b71Sopenharmony_ci }); 54e41f4b71Sopenharmony_ci } catch (err) { 55e41f4b71Sopenharmony_ci // Process input parameter errors. 56e41f4b71Sopenharmony_ci let code = (err as BusinessError).code; 57e41f4b71Sopenharmony_ci let message = (err as BusinessError).message; 58e41f4b71Sopenharmony_ci console.error(`openAtomicService failed, code is ${code}, message is ${message}`); 59e41f4b71Sopenharmony_ci } 60e41f4b71Sopenharmony_ci } 61e41f4b71Sopenharmony_ci} 62e41f4b71Sopenharmony_ci``` 63