# @ohos.ability.featureAbility (FeatureAbility) The **FeatureAbility** module provides APIs that enable user interaction. You can use the APIs to start or terminate an ability, obtain a **dataAbilityHelper** object, obtain the window corresponding to the current ability, and connect to or disconnect from a ServiceAbility. > **NOTE** > > The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The APIs of this module can be used only in the FA model. ## Constraints The APIs of the **FeatureAbility** module can be called only by PageAbilities. ## Modules to Import ```ts import featureAbility from '@ohos.ability.featureAbility'; ``` ## featureAbility.startAbility startAbility(parameter: StartAbilityParameter, callback: AsyncCallback\): void Starts an ability. This API uses an asynchronous callback to return the result. Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the FA model, see [Component Startup Rules (FA Model)](../../application-models/component-startup-rules-fa.md). **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel **Parameters** | Name | Type | Mandatory | Description | | --------- | ---------------------------------------- | ---- | -------------- | | parameter | [StartAbilityParameter](js-apis-inner-ability-startAbilityParameter.md) | Yes | Ability to start.| | callback | AsyncCallback\ | Yes | Callback used to return the result. | **Example** ```ts import featureAbility from '@ohos.ability.featureAbility'; import wantConstant from '@ohos.ability.wantConstant'; featureAbility.startAbility( { want: { action: "", entities: [""], type: "", flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, deviceId: "", bundleName: "com.example.myapplication", /* In the FA model, abilityName consists of package and ability names. */ abilityName: "com.example.myapplication.secondAbility", uri: "" }, }, (err, data) => { console.info("startAbility err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); } ); ``` ## featureAbility.startAbility startAbility(parameter: StartAbilityParameter): Promise\ Starts an ability. This API uses a promise to return the result. Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the FA model, see [Component Startup Rules (FA Model)](../../application-models/component-startup-rules-fa.md). **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel **Parameters** | Name | Type | Mandatory | Description | | --------- | ---------------------------------------- | ---- | -------------- | | parameter | [StartAbilityParameter](js-apis-inner-ability-startAbilityParameter.md) | Yes | Ability to start.| **Return value** | Type | Description | | ---------------------------------------- | ------- | | Promise\ | Promise used to return the result.| **Example** ```ts import featureAbility from '@ohos.ability.featureAbility'; import wantConstant from '@ohos.ability.wantConstant'; featureAbility.startAbility( { want: { action: "action.system.home", entities: ["entity.system.home"], type: "MIMETYPE", flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, deviceId: "", bundleName: "com.example.myapplication", /* In the FA model, abilityName consists of package and ability names. */ abilityName: "com.example.myapplication.secondAbility", uri: "" }, } ).then((data) => { console.info("startAbility data: " + JSON.stringify(data)); }); ``` ## featureAbility.acquireDataAbilityHelper7+ acquireDataAbilityHelper(uri: string): DataAbilityHelper Obtains a **dataAbilityHelper** object. Observe the following when using this API: - To access a DataAbility of another application, the target application must be configured with associated startup (**AssociateWakeUp** set to **true**). - If an application running in the background needs to call this API to access a DataAbility, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the FA model, see [Component Startup Rules (FA Model)](../../application-models/component-startup-rules-fa.md). **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel **Parameters** | Name | Type | Mandatory | Description | | ---- | ------ | ---- | ------------ | | uri | string | Yes | URI of the file to open.| **Return value** | Type | Description | | ----------------- | ------------------------------- | | [DataAbilityHelper](js-apis-inner-ability-dataAbilityHelper.md) | A utility class used to help other abilities access the Data ability.| **Example** ```ts import featureAbility from '@ohos.ability.featureAbility'; var dataAbilityHelper = featureAbility.acquireDataAbilityHelper( "dataability:///com.example.DataAbility" ); ``` ## featureAbility.startAbilityForResult7+ startAbilityForResult(parameter: StartAbilityParameter, callback: AsyncCallback\): void Starts an ability. After the ability is started, you can call [terminateSelfWithResult](#featureabilityterminateselfwithresult7) to terminate the ability and return the result to the caller. If an exception occurs, for example, the ability is killed, exception information is returned to the caller. This API uses an asynchronous callback to return the result. Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the FA model, see [Component Startup Rules (FA Model)](../../application-models/component-startup-rules-fa.md). **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel **Parameters** | Name | Type | Mandatory | Description | | --------- | ---------------------------------------- | ---- | -------------- | | parameter | [StartAbilityParameter](js-apis-inner-ability-startAbilityParameter.md) | Yes | Ability to start.| | callback | AsyncCallback\<[AbilityResult](js-apis-inner-ability-abilityResult.md)> | Yes | Callback used to return the result. | **Example** ```ts import featureAbility from '@ohos.ability.featureAbility'; import wantConstant from '@ohos.ability.wantConstant'; featureAbility.startAbilityForResult( { want: { action: "action.system.home", entities: ["entity.system.home"], type: "MIMETYPE", flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, deviceId: "", bundleName: "com.example.myapplication", /* In the FA model, abilityName consists of package and ability names. */ abilityName: "com.example.myapplication.secondAbility", uri:"" }, }, (err, data) => { console.info("startAbilityForResult err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); } ); ``` ## featureAbility.startAbilityForResult7+ startAbilityForResult(parameter: StartAbilityParameter): Promise\ Starts an ability. After the ability is started, you can call [terminateSelfWithResult](#featureabilityterminateselfwithresult7) to terminate the ability and return the result to the caller. If an exception occurs, for example, the ability is killed, exception information is returned to the caller. This API uses a promise to return the result. Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the FA model, see [Component Startup Rules (FA Model)](../../application-models/component-startup-rules-fa.md). **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel **Parameters** | Name | Type | Mandatory | Description | | --------- | ---------------------------------------- | ---- | ------------- | | parameter | [StartAbilityParameter](js-apis-inner-ability-startAbilityParameter.md) | Yes | Ability to start.| **Return value** | Type | Description | | ---------------------------------------- | ------- | | Promise\<[AbilityResult](js-apis-inner-ability-abilityResult.md)> | Promise used to return the result.| **Example** ```ts import featureAbility from '@ohos.ability.featureAbility'; import wantConstant from '@ohos.ability.wantConstant'; featureAbility.startAbilityForResult( { want: { action: "action.system.home", entities: ["entity.system.home"], type: "MIMETYPE", flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, deviceId: "", bundleName: "com.example.myapplication", /* In the FA model, abilityName consists of package and ability names. */ abilityName: "com.example.myapplication.secondAbility", uri:"", parameters: { mykey0: 1111, mykey1: [1, 2, 3], mykey2: "[1, 2, 3]", mykey3: "xxxxxxxxxxxxxxxxxxxxxx", mykey4: [1, 15], mykey5: [false, true, false], mykey6: ["aaaaaa", "bbbbb", "ccccccccccc"], mykey7: true, }, }, }, ).then((data) => { console.info("startAbilityForResult data: " + JSON.stringify(data)); }); ``` ## featureAbility.terminateSelfWithResult7+ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback\): void Terminates this ability. If the ability is started by calling [startAbilityForResult](#featureabilitystartabilityforresult7), the result is returned to the caller in the form of a callback when **terminateSelfWithResult** is called. Otherwise, no result is returned to the caller when **terminateSelfWithResult** is called. **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel **Parameters** | Name | Type | Mandatory | Description | | --------- | ------------------------------- | ---- | -------------- | | parameter | [AbilityResult](js-apis-inner-ability-abilityResult.md) | Yes | Result returned after the ability is terminated.| | callback | AsyncCallback\ | Yes | Callback used to return the result. | **Example** ```ts import featureAbility from '@ohos.ability.featureAbility'; import wantConstant from '@ohos.ability.wantConstant'; featureAbility.terminateSelfWithResult( { resultCode: 1, want: { action: "action.system.home", entities: ["entity.system.home"], type: "MIMETYPE", flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, deviceId: "", bundleName: "com.example.myapplication", /* In the FA model, abilityName consists of package and ability names. */ abilityName: "com.example.myapplication.secondAbility", uri:"", parameters: { mykey0: 2222, mykey1: [1, 2, 3], mykey2: "[1, 2, 3]", mykey3: "ssssssssssssssssssssssssss", mykey4: [1, 15], mykey5: [false, true, false], mykey6: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], mykey7: true, } }, }, (err) => { console.info("err: " + JSON.stringify(err)) } ); ``` ## featureAbility.terminateSelfWithResult7+ terminateSelfWithResult(parameter: AbilityResult): Promise\ Terminates this ability. If the ability is started by calling [startAbilityForResult](#featureabilitystartabilityforresult7), the result is returned to the caller in the form of a promise when **terminateSelfWithResult** is called. Otherwise, no result is returned to the caller when **terminateSelfWithResult** is called. **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel **Parameters** | Name | Type | Mandatory | Description | | --------- | ------------------------------- | ---- | ------------- | | parameter | [AbilityResult](js-apis-inner-ability-abilityResult.md) | Yes | Result returned after the ability is terminated.| **Return value** | Type | Description | | -------------- | --------------- | | Promise\ | Promise used to return the result.| **Example** ```ts import featureAbility from '@ohos.ability.featureAbility'; import wantConstant from '@ohos.ability.wantConstant'; featureAbility.terminateSelfWithResult( { resultCode: 1, want: { action: "action.system.home", entities: ["entity.system.home"], type: "MIMETYPE", flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, deviceId: "", bundleName: "com.example.myapplication", /* In the FA model, abilityName consists of package and ability names. */ abilityName: "com.example.myapplication.secondAbility", uri:"", parameters: { mykey0: 2222, mykey1: [1, 2, 3], mykey2: "[1, 2, 3]", mykey3: "ssssssssssssssssssssssssss", mykey4: [1, 15], mykey5: [false, true, false], mykey6: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], mykey7: true, } }, } ).then((data) => { console.info("==========================>terminateSelfWithResult=======================>"); }); ``` ## featureAbility.hasWindowFocus7+ hasWindowFocus(callback: AsyncCallback\): void Checks whether the main window of this ability has the focus. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel **Parameters** | Name | Type | Mandatory | Description | | -------- | ----------------------- | ---- | ---------------------------------------- | | callback | AsyncCallback\ | Yes | Callback used to return the result.
If the main window has the focus, **true** is returned. Otherwise, **false** is returned.| **Example** ```ts import featureAbility from '@ohos.ability.featureAbility'; featureAbility.hasWindowFocus((err, data) => { console.info("hasWindowFocus err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); }); ``` ## featureAbility.hasWindowFocus7+ hasWindowFocus(): Promise\ Checks whether the main window of this ability has the focus. This API uses a promise to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel **Return value** | Type | Description | | ----------------- | ------------------------------------- | | Promise\ | Promise used to return the result. If the main window has the focus, **true** is returned. Otherwise, **false** is returned.| **Example** ```ts import featureAbility from '@ohos.ability.featureAbility'; featureAbility.hasWindowFocus().then((data) => { console.info("hasWindowFocus data: " + JSON.stringify(data)); }); ``` ## featureAbility.getWant getWant(callback: AsyncCallback\): void Obtains the Want corresponding to the ability to start. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel **Parameters** | Name | Type | Mandatory | Description | | -------- | ----------------------------- | ---- | --------- | | callback | AsyncCallback\<[Want](js-apis-application-want.md)> | Yes | Callback used to return the Want.| **Example** ```ts import featureAbility from '@ohos.ability.featureAbility'; featureAbility.getWant((err, data) => { console.info("getWant err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); }); ``` ## featureAbility.getWant getWant(): Promise\ Obtains the Want corresponding to the ability to start. This API uses a promise to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel **Return value** | Type | Description | | ----------------------- | ---------------- | | Promise\<[Want](js-apis-application-want.md)> | Promise used to return the Want.| **Example** ```ts import featureAbility from '@ohos.ability.featureAbility'; featureAbility.getWant().then((data) => { console.info("getWant data: " + JSON.stringify(data)); }); ``` ## featureAbility.getContext getContext(): Context Obtains the application context. **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel **Return value** | Type | Description | | ------- | ---------- | | Context | Application context.| **Example** ```ts import featureAbility from '@ohos.ability.featureAbility'; var context = featureAbility.getContext() context.getBundleName((err, data) => { console.info("getBundleName err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); }); ``` ## featureAbility.terminateSelf7+ terminateSelf(callback: AsyncCallback\): void Terminates this ability. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel **Parameters** | Name | Type | Mandatory | Description | | -------- | -------------------- | ---- | -------- | | callback | AsyncCallback\ | Yes | Callback used to return the result.| **Example** ```ts import featureAbility from '@ohos.ability.featureAbility'; featureAbility.terminateSelf( (err) => { console.info("err: " + JSON.stringify(err)) } ) ``` ## featureAbility.terminateSelf7+ terminateSelf(): Promise\ Terminates this ability. This API uses a promise to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel **Return value** | Type | Description | | -------------- | ---------------- | | Promise\ | Promise used to return the result.| **Example** ```ts import featureAbility from '@ohos.ability.featureAbility'; featureAbility.terminateSelf().then((data) => { console.info("==========================>terminateSelf=======================>"); }); ``` ## featureAbility.connectAbility7+ connectAbility(request: Want, options:ConnectOptions): number Connects this ability to a ServiceAbility. Observe the following when using this API: - To connect to a ServiceAbility of another application, the target application must be configured with associated startup (**AssociateWakeUp** set to **true**).. - If an application running in the background needs to call this API to connect to a ServiceAbility, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the FA model, see [Component Startup Rules (FA Model)](../../application-models/component-startup-rules-fa.md). **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel **Parameters** | Name | Type | Mandatory | Description | | ------- | -------------- | ---- | --------------------- | | request | [Want](js-apis-application-want.md) | Yes | ServiceAbility to connect.| | options | [ConnectOptions](js-apis-inner-ability-connectOptions.md) | Yes | Connection options. | **Return value** | Type | Description | | ------ | -------------------- | | number | ID of the connected ServiceAbility. The ID starts from 0 and is incremented by 1 each time a connection is set up.| **Example** ```ts import rpc from '@ohos.rpc'; import featureAbility from '@ohos.ability.featureAbility'; function onConnectCallback(element, remote){ console.log('ConnectAbility onConnect remote is proxy:' + (remote instanceof rpc.RemoteProxy)); } function onDisconnectCallback(element){ console.log('ConnectAbility onDisconnect element.deviceId : ' + element.deviceId) } function onFailedCallback(code){ console.log('featureAbilityTest ConnectAbility onFailed errCode : ' + code) } var connectId = featureAbility.connectAbility( { deviceId: "", bundleName: "com.ix.ServiceAbility", abilityName: "com.ix.ServiceAbility.ServiceAbilityA", }, { onConnect: onConnectCallback, onDisconnect: onDisconnectCallback, onFailed: onFailedCallback, }, ); ``` ## featureAbility.disconnectAbility7+ disconnectAbility(connection: number, callback:AsyncCallback\): void Disconnects this ability from a specific ServiceAbility. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel **Parameters** | Name | Type | Mandatory | Description | | ---------- | -------------------- | ---- | ----------------------- | | connection | number | Yes | ID of the ServiceAbility to disconnect.| | callback | AsyncCallback\ | Yes | Callback used to return the result. | **Example** ```ts import rpc from '@ohos.rpc'; import featureAbility from '@ohos.ability.featureAbility'; function onConnectCallback(element, remote){ console.log('ConnectAbility onConnect remote is proxy:' + (remote instanceof rpc.RemoteProxy)); } function onDisconnectCallback(element){ console.log('ConnectAbility onDisconnect element.deviceId : ' + element.deviceId) } function onFailedCallback(code){ console.log('featureAbilityTest ConnectAbility onFailed errCode : ' + code) } var connectId = featureAbility.connectAbility( { bundleName: "com.ix.ServiceAbility", abilityName: "com.ix.ServiceAbility.ServiceAbilityA", }, { onConnect: onConnectCallback, onDisconnect: onDisconnectCallback, onFailed: onFailedCallback, }, ); var result = featureAbility.disconnectAbility(connectId, (error) => { console.log('featureAbilityTest DisConnectJsSameBundleName result errCode : ' + error.code) }, ); ``` ## featureAbility.disconnectAbility7+ disconnectAbility(connection: number): Promise\ Disconnects this ability from a specific ServiceAbility. This API uses a promise to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel **Parameters** | Name | Type | Mandatory | Description | | ---------- | ------ | ---- | ----------------------- | | connection | number | Yes | ID of the ServiceAbility to disconnect.| **Return value** | Type | Description | | -------------- | --------------- | | Promise\ | Promise used to return the result.| **Example** ```ts import rpc from '@ohos.rpc'; import featureAbility from '@ohos.ability.featureAbility'; function onConnectCallback(element, remote){ console.log('ConnectAbility onConnect remote is proxy:' + (remote instanceof rpc.RemoteProxy)); } function onDisconnectCallback(element){ console.log('ConnectAbility onDisconnect element.deviceId : ' + element.deviceId) } function onFailedCallback(code){ console.log('featureAbilityTest ConnectAbility onFailed errCode : ' + code) } var connectId = featureAbility.connectAbility( { bundleName: "com.ix.ServiceAbility", abilityName: "com.ix.ServiceAbility.ServiceAbilityA", }, { onConnect: onConnectCallback, onDisconnect: onDisconnectCallback, onFailed: onFailedCallback, }, ); featureAbility.disconnectAbility(connectId).then((data) => { console.log('data : ' + data); }).catch((error)=>{ console.log('featureAbilityTest result errCode : ' + error.code); }); ``` ## featureAbility.getWindow7+ getWindow(callback: AsyncCallback\): void Obtains the window corresponding to this ability. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel **Parameters** | Name | Type | Mandatory| Description | | -------- | ----------------------------- | ---- | ----------------------------- | | callback | AsyncCallback\<[window.Window](js-apis-window.md#window)> | Yes | Callback used to return the window.| **Example** ```ts featureAbility.getWindow((err, data) => { console.info("getWindow err: " + JSON.stringify(err) + "data: " + typeof(data)); }); ``` ## featureAbility.getWindow7+ getWindow(): Promise\; Obtains the window corresponding to this ability. This API uses a promise to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel **Return value** | Type | Description | | ----------------------- | ----------------------------- | | Promise\<[window.Window](js-apis-window.md#window)> | Promise used to return the window.| **Example** ```ts featureAbility.getWindow().then((data) => { console.info("getWindow data: " + typeof(data)); }); ``` ## AbilityWindowConfiguration Defines the window configuration corresponding to this ability. The configuration is obtained through **featureAbility.AbilityWindowConfiguration**. **Example** ``` featureAbility.AbilityWindowConfiguration.WINDOW_MODE_UNDEFINED ``` **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel | Name | Value | Description | | ---------------------------------------- | ---- | ---------------------------------------- | | WINDOW_MODE_UNDEFINED7+ | 0 | The PageAbility is in an undefined window display mode.| | WINDOW_MODE_FULLSCREEN7+ | 1 | The PageAbility is in full screen mode. | | WINDOW_MODE_SPLIT_PRIMARY7+ | 100 | The PageAbility is displayed in the primary window when it is in split-screen mode.| | WINDOW_MODE_SPLIT_SECONDARY7+ | 101 | The PageAbility is displayed in the secondary window when it is in split-screen mode.| | WINDOW_MODE_FLOATING7+ | 102 | The PageAbility is displayed in floating window mode.| ## AbilityStartSetting Defines the window attribute corresponding to this ability. The **abilityStartSetting** attribute is an object defined in the format of [**key: string]: any**, where **key** is an enumerated value of **AbilityStartSetting** and **value** is an enumerated value of **AbilityWindowConfiguration**. The value is obtained through **featureAbility.AbilityStartSetting**. **Example** ``` featureAbility.AbilityStartSetting.BOUNDS_KEY ``` **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel | Name | Value | Description | | ---------------------------- | --------------- | ---------------------------------------- | | BOUNDS_KEY7+ | "abilityBounds" | Ability window size.| | WINDOW_MODE_KEY7+ | "windowMode" | Ability window display mode.| | DISPLAY_ID_KEY7+ | "displayId" | Display device ID.| ## ErrorCode Enumerates the error codes. **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel | Name | Value | Description | | ------------------------------ | ---- | ---------------------------------------- | | NO_ERROR7+ | 0 | No error occurs.| | INVALID_PARAMETER7+ | -1 | Invalid parameter.| | ABILITY_NOT_FOUND7+ | -2 | The ability is not found.| | PERMISSION_DENY7+ | -3 | Permission denied.| ## DataAbilityOperationType Enumerates the operation types of a DataAbility. The DataAbility can use an enumerated value to specify the operation type when operating data in batches. **System capability**: SystemCapability.Ability.AbilityRuntime.FAModel | Name | Value | Description | | ------------------------ | ---- | ---------------------------------------- | | TYPE_INSERT7+ | 1 | Insert operation.| | TYPE_UPDATE7+ | 2 | Update operation.| | TYPE_DELETE7+ | 3 | Deletion operation.| | TYPE_ASSERT7+ | 4 | Assert operation.| ## flags Enumerates the flags that specify how the Want will be handled. **System capability**: SystemCapability.Ability.AbilityBase | Name | Value | Description | | ------------------------------------ | ---------- | ---------------------------------------- | | FLAG_AUTH_READ_URI_PERMISSION | 0x00000001 | Grants the permission to read the URI. | | FLAG_AUTH_WRITE_URI_PERMISSION | 0x00000002 | Grants the permission to write data to the URI. | | FLAG_ABILITY_FORWARD_RESULT | 0x00000004 | Returns the result to the ability. | | FLAG_ABILITY_CONTINUATION | 0x00000008 | Continues the ability on a remote device. | | FLAG_NOT_OHOS_COMPONENT | 0x00000010 | Indicates that a component does not belong to OHOS. | | FLAG_ABILITY_FORM_ENABLED | 0x00000020 | Indicates whether the FormAbility is enabled. | | FLAG_AUTH_PERSISTABLE_URI_PERMISSION | 0x00000040 | Grants the permission to make the URI persistent.
**System API**: This is a system API and cannot be called by third-party applications. | | FLAG_AUTH_PREFIX_URI_PERMISSION | 0x00000080 | Grants the permission to verify URIs by prefix matching.
**System API**: This is a system API and cannot be called by third-party applications. | | FLAG_ABILITYSLICE_MULTI_DEVICE | 0x00000100 | Indicates the support for cross-device startup in the distributed scheduler. | | FLAG_START_FOREGROUND_ABILITY | 0x00000200 | Indicates that the ability is started in the foreground regardless of whether the host application is started.
**System API**: This is a system API and cannot be called by third-party applications. | | FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | Indicates that the migration is reversible. | | FLAG_INSTALL_ON_DEMAND | 0x00000800 | Indicates that the specific ability will be installed if it has not been installed. | | FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | Indicates that the specific ability will be installed in the background if it has not been installed. | | FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for the **Want** object in the **startAbility** API passed to [ohos.app.Context](js-apis-ability-context.md) and must be used together with **flag_ABILITY_NEW_MISSION**.| | FLAG_ABILITY_NEW_MISSION | 0x10000000 | Creates a mission on an existing mission stack. | | FLAG_ABILITY_MISSION_TOP | 0x20000000 | Reuses an ability instance if it is on the top of an existing mission stack; creates an ability instance otherwise.|