openharmony 鸿蒙 js-apis-app-form-formInfo-sys

2025-06-12 浏览 (1)

@ohos.app.form.formInfo (formInfo) (System API)

The formInfo module provides types and enums related to the widget information and state.

NOTE

The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. This topic describes only system APIs provided by the module. For details about its public APIs, see @ohos.app.form.formInfo (formInfo).

Modules to Import

import { formInfo } from '@kit.FormKit';

FormParam

Enumerates the widget parameters.

System capability: SystemCapability.Ability.Form

NameValueDescription
DEVICE_ID_KEY'ohos.extra.param.key.device_id'Device ID.
System API: This is a system API.

FormUsageState

Enumerates the usage statuses of widgets.

System capability: SystemCapability.Ability.Form

System API: This is a system API.

NameValueDescription
USED11+0The widget is in use.
UNUSED11+1The widget is not in use.

RunningFormInfo10+

Defines the information about an added widget, which can be either in use or not.

System capability: SystemCapability.Ability.Form

System API: This is a system API.

NameTypeReadableWritableDescription
formIdstringYesNoWidget ID.
bundleName10+stringYesNoName of the bundle to which the widget provider belongs.
hostBundleNamestringYesNoName of the bundle to which the widget host belongs.
visibilityTypeVisibilityTypeYesNoVisibility types of the widget.
moduleName10+stringYesNoName of the module to which the widget belongs.
abilityName10+stringYesNoName of the ability to which the widget belongs.
formName10+stringYesNoWidget name.
dimensionnumberYesNoWidget specifications.
formUsageState11+FormUsageStateYesNoUsage status of the widget.
formDescription11+stringYesNoDescription in the widget configuration file of the provider.
formLocation12+FormLocationYesNoLocation of the widget.

formProviderFilter10+

Defines the information about the widget provider.

Model restriction: This API can be used only in the stage model.

System capability: SystemCapability.Ability.Form

System API: This is a system API.

NameTypeReadableWritableDescription
bundleNamestringYesNoName of the bundle to which the widget provider belongs.
formNamestringYesNoWidget name.
moduleNamestringYesNoName of the module to which the widget belongs.
abilityNamestringYesNoName of the ability to which the widget belongs.
isUnusedIncluded11+booleanYesNoWhether an unused widget is included.

FormInfoFilter

Defines the widget information filter. Only the widget information that meets the filter is returned.

Atomic service API: This API can be used in atomic services since API version 11.

System capability: SystemCapability.Ability.Form

NameTypeMandatoryDescription
bundleNamestringNoOnly the widget information in which bundleName is the same as the provided value is returned. If this parameter is left unspecified, the widget information is not filtered by bundleName.
System API: This is a system API.
supportedDimensionsArray<number>NoOnly the widget information in which supportedDimensions is the same as the provided value is returned. If this parameter is left unspecified, the widget information is not filtered by supportedDimensions.
System API: This is a system API.
supportedShapes12+Array<number>NoOnly the widget information in which supportedShapes is the same as the provided value is returned. If this parameter is left unspecified, the widget information is not filtered by supportedShapes.
System API: This is a system API.

FormLocation12+

Enumerates the widget locations.

System capability: SystemCapability.Ability.Form

NameValueDescription
OTHER-1The widget is not located in any of the following defined positions.
DESKTOP0The widget is located on the home screen.
FORM_CENTER1The widget is located in the widget center of the home screen.
FORM_MANAGER2The widget is located in the widget manager of the home screen.
NEGATIVE_SCREEN3The widget is located on the minus 1 screen.
FORM_CENTER_NEGATIVE_SCREEN4The widget is located in the service panel of the minus 1 screen.
FORM_MANAGER_NEGATIVE_SCREEN5The widget is located in the widget manager of the minus 1 screen.
SCREEN_LOCK6The widget is located on the locked screen.
AI_SUGGESTION7The widget is located in the area of Celia Suggestions.

PublishFormResult12+

Describes the result for the operation of adding a widget to the home screen.

System capability: SystemCapability.Ability.Form

NameTypeReadableWritableDescription
codePublishFormErrorCodeYesNoResult code of the operation.
messagestringYesNoMessage returned for the operation.

PublishFormErrorCode12+

Enumerates the result codes that may be used for the operation of adding a widget to the home screen.

System capability: SystemCapability.Ability.Form

NameValueDescription
SUCCESS0The widget is added to the home screen.
NO_SPACE1There is no space for adding widgets.
PARAM_ERROR2Parameter check fails.
INTERNAL_ERROR3An internal error occurs during widget processing.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Form Kit

harmony 鸿蒙Form Error Codes

harmony 鸿蒙@ohos.app.form.formAgent (FormAgent) (System API)

harmony 鸿蒙@ohos.app.form.formBindingData (formBindingData)

harmony 鸿蒙@ohos.app.form.FormEditExtensionAbility (FormEditExtensionAbility)

harmony 鸿蒙@ohos.app.form.FormExtensionAbility (FormExtensionAbility) (System API)

harmony 鸿蒙@ohos.app.form.FormExtensionAbility (FormExtensionAbility)

harmony 鸿蒙@ohos.app.form.formHost (formHost) (System API)

harmony 鸿蒙@ohos.app.form.formInfo (formInfo)

harmony 鸿蒙@ohos.app.form.formObserver (formObserver) (System API)

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/GFEEju