openharmony 鸿蒙 module-switch

2023-02-03 浏览 (731)

Switching of module

When switching an application from the FA model to the stage model, migrate the configurations under module in the config.json file to module in the module.json5 file.

Table 1 module comparison

Field Name in the FA ModelField DescriptionField Name in the Stage ModelDifference
mainAbilityAbility displayed on the Service Center icon. When the resident process is started, the mainAbility is started.mainElementThe field name is changed, and the stage mode does not use the period (.) in ability names.
packagePackage name of the HAP file, which must be unique in the application./The stage model uses name to ensure application uniqueness. To ensure a successful switching from the FA model to the stage model, name in the stage model must be the same as package in the FA model.
nameClass name of the HAP file./This configuration is not enabled in the FA model, and the stage model does not have such a field.
supportedModesModes supported by the application. Currently, only the drive mode is defined./This configuration is deprecated in the stage model.
moduleName in the distro objectName of the current HAP file.
moduleName in the distro object.
nameThe field name is changed.
moduleType in the distro objectType of the HAP file. The value can be entry or feature. For the HAR type, set this field to har.typeThe field name is changed.
installationFree in the distro objectWhether the HAP file supports the installation-free feature.installationFreeThe field name is changed.
deliveryWithInstall in the distro objectWhether the HAP file is installed with the application.deliveryWithInstallThe field name is changed.
metaDataMetadata of the HAP file.metadataFor details, see Table 2.
abilitiesAll abilities in the current module.abilitiesFor details, see Table 5.
jsA set of JS modules developed using ArkUI. Each element in the set represents the information about a JS module.pagesThe stage model retains pages under the module tag. The window configuration is the lower level of pages.
shortcutsShortcuts of the application.shortcut_config.jsonIn the stage model, the shortcut_config.json file is defined in resources/base/profile in the developer view.
reqPermissionsPermissions that the application requests from the system when it is running.requestPermissionsThe field name is changed.
colorModeColor mode of the application./This configuration is not supported in the stage model.
distroFilterDistribution rules of the application.distributionFilter_config.jsonIn the stage model, the distributionFilter_config.json file is defined in resources/base/profile in the developer view.
reqCapabilitiesDevice capabilities required for running the application./This configuration is not supported in the stage model.
commonEventsCommon events.common_event_config.jsonIn the stage model, the common_event_config.json file is defined in resources/base/profile in the developer view.
entryThemeKeyword of an internal theme./This configuration is not supported in the stage model.

Table 2 metaData comparison

Field Name in the FA ModelField DescriptionField Name in the Stage ModelDifference
parametersMetadata of the parameters to be passed for calling the ability./This configuration is not supported in the stage model.
resultsMetadata of the ability return value./This configuration is not supported in the stage model.
customizeDataCustom metadata of the parent component. parameters and results cannot be configured in application.metadataFor details, see Table 3.

Table 3 Comparison between customizeData under metaData in the FA model and metadata in the stage Model

Field Name in the FA ModelField DescriptionField Name in the Stage ModelDifference
nameKey name that identifies a data item. The value is a string with a maximum of 255 bytes.nameNone.
valueValue of the data item. The value is a string with a maximum of 255 bytes.valueNone.
extraFormat of the current custom data. The value is the resource value of extra.resourceThe field name is changed. For details, see Table 4.

Table 4 metaData examples

Example in the FA ModelExample in the Stage Model
"meteData": {
"customizeDate": [{
"name": "label",
"value": "string",
"extra": "$string:label",
}]
}
"meteData": [{
"name": "label",
"value": "string",
"resource": "$string:label",
}]

Table 5 abilities comparison

Field Name Under abilities in the FA ModelField DescriptionField Name Under abilities in the Stage ModelDifference
processName of the process running the application or ability./The stage model does not support configuration of process under abilities. The configuration of process is available under the module tag.
uriURI of the ability./This configuration is not supported in the stage model.
deviceCapabilityDevice capabilities required to run the ability./This configuration is not supported in the stage model.
metaDataMetadata of the ability.metadataFor details, see Table 2.
typeAbility type./This configuration is not supported in the stage model.
grantPermissionWhether permissions can be granted to any data in the ability./The stage model does not support such a configuration under abilities.
readPermissionPermission required for reading data in the ability. This field applies only to the ability using the Data template./In the stage model, this configuration is available under extensionAbilities, but not abilities.
writePermissionPermission required for writing data to the ability./In the stage model, this configuration is available under extensionAbilities, but not abilities.
configChangesSystem configurations that the ability concerns./This configuration is not supported in the stage model.
missionMission stack of the ability./This configuration is not supported in the stage model.
targetAbilityTarget ability that this ability alias points to./This configuration is not supported in the stage model.
multiUserSharedWhether the ability supports data sharing among multiple users. This field applies only to the ability using the Data template./This configuration is not supported in the stage model.
supportPipModeWhether the ability allows the user to enter the Picture in Picture (PiP) mode. The PiP mode enables the user to watch a video in a small window that hovers on top of a full screen window (main window)./This configuration is not supported in the stage model.
formsEnabledWhether the ability can provide widgets./This configuration is not supported in the stage model.
formsInformation about the widgets used by the ability. This field is valid only when formsEnabled is set to true.form_config.jsonIn the stage model, the form_config.json file is defined in resources/base/profile in the developer view.
srcLanguageProgramming language used to develop the ability./This configuration is not supported in the stage model.
srcPathPath of the JS component code corresponding to the ability.srcEntryPath of the JS code corresponding to the ability.
uriPermissionApplication data that the ability can access./This configuration is not supported in the stage model.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Ability Kit

harmony 鸿蒙Obtaining Reasons for Abnormal Application Exits

harmony 鸿蒙UIAbility Backup and Restore

harmony 鸿蒙Using Explicit Want to Start an Application Component

harmony 鸿蒙Introduction to Ability Kit

harmony 鸿蒙AbilityStage Component Container

harmony 鸿蒙Accessing a DataAbility

harmony 鸿蒙Accessing a DataShareExtensionAbility from the FA Model

harmony 鸿蒙Common action and entities Values (Not Recommended)

harmony 鸿蒙API Switching Overview

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