@ohos.app.ability.insightIntent (Basic Definitions of InsightIntent Framework)

This module provides basic definitions of the InsightIntent framework.

NOTE

The initial APIs of this module are supported since API version 11. 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 stage model.

Modules to Import

import { insightIntent } from '@kit.AbilityKit';

ExecuteMode

Enumerates the intent execution modes. It specifies the mode of execution passed when the intent is triggered by a system entry point. The supported execution modes for each intent are defined during intent development.

System capability: SystemCapability.Ability.AbilityRuntime.Core

Name Value Description
UI_ABILITY_FOREGROUND 0 Display a UIAbility in the foreground.
Atomic service API: This API can be used in atomic services since API version 11.
UI_ABILITY_BACKGROUND 1 Start a UIAbility in the background.
Atomic service API: This API can be used in atomic services since API version 11.
UI_EXTENSION_ABILITY 2 Start a UIExtensionAbility.

ExecuteResult

Enumerates the return results of intent execution.

System capability: SystemCapability.Ability.AbilityRuntime.Core

Name Type Read-only Optional Description
code number No No Error code returned by the intent execution, defined by the developer.
Atomic service API: This API can be used in atomic services since API version 11.
result Record<string, Object> No Yes Result data returned by the intent execution, typically containing information to be passed back to the system entry point.
Atomic service API: This API can be used in atomic services since API version 11.
uris18+ Array<string> No Yes List of URIs returned by the intent execution. This field must be used together with the flags field to grant the corresponding permissions for the URI list to the system entry point.
Atomic service API: This API can be used in atomic services since API version 18.
flags18+ number No Yes Permissions to be granted to the system entry point for the URI list returned by the intent execution.
Atomic service API: This API can be used in atomic services since API version 18.
NOTE
This parameter supports only FLAG_AUTH_READ_URI_PERMISSION, FLAG_AUTH_WRITE_URI_PERMISSION, and FLAG_AUTH_READ_URI_PERMISSION|FLAG_AUTH_WRITE_URI_PERMISSION. For details about the permissions, see Flags.

IntentEntity20+

Defines the struct of an intent entity. It represents key information objects involved during intent execution, including intent parameters and execution results.

You can define intent entities by inheriting this class. The child class must be decorated with @InsightIntentEntity.

System capability: SystemCapability.Ability.AbilityRuntime.Core

Name Type Read-only Optional Description
entityId string No No ID of the intent entity.
Atomic service API: This API can be used in atomic services since API version 20.

IntentResult<T>20+

Defines the return result of intent execution. The generic type is supported.

System capability: SystemCapability.Ability.AbilityRuntime.Core

Name Type Read-only Optional Description
code number No No Error code returned by the intent execution, defined by the developer.
Atomic service API: This API can be used in atomic services since API version 20.
result T No Yes Result data returned by the intent execution, typically containing information to be passed back to the system entry point.
Atomic service API: This API can be used in atomic services since API version 20.

ReturnMode23+

Enumerates the modes that define how the execution result of an intent is returned to the intent initiator.

System capability: SystemCapability.Ability.AbilityRuntime.Core

Name Value Description
CALLBACK 0 The intent execution result is returned through the onExecuteInUIAbilityForegroundMode or onExecuteInUIExtensionAbility API in the intent execution base class.
Atomic service API: This API can be used in atomic services since API version 23.
FUNCTION 1 The intent execution result is returned after the sendExecuteResult or sendIntentResult API in intent provider management is called.
Atomic service API: This API can be used in atomic services since API version 23.