openharmony 鸿蒙 deviceconfig-structure

2023-02-03 浏览 (776)

Structure of the deviceConfig Tag

The deviceConfig tag contains device-specific configuration of the application, including attributes such as default, tv, car, and wearable. The default configuration applies to all types of devices. You need to declare the peculiar configuration of a specific device type in the associated sub-tag of this type.

Internal Structure of the deviceConfig Tag

Table 1 Internal structure of the deviceConfig tag

NameDescriptionData TypeInitial Value Allowed
defaultApplication configuration that provides full access to system capabilities.ObjectYes (initial value: left empty)
tabletApplication configuration specific to tablets.ObjectYes (initial value: left empty)
tvApplication configuration specific to smart TVs.ObjectYes (initial value: left empty)
carApplication configuration specific to telematics devices.ObjectYes (initial value: left empty)
wearableApplication configuration specific to wearables.ObjectYes (initial value: left empty)

For details about the attributes of the deviceConfig tag, see Internal Structure of the deviceConfig Attributes.

Internal Structure of the deviceConfig Attributes

Table 2 Internal structure of the deviceConfig attributes

NameDescriptionData TypeInitial Value Allowed
processName of the process running the application or ability. If the process attribute is configured in the deviceConfig tag, all abilities of the application run in this process. You can set the process attribute for a specific ability in the abilities attribute, so that the ability can run in the particular process. The value can contain a maximum of 31 characters.StringYes (initial value: left empty)
keepAliveWhether the application is always running. This attribute applies only to system applications and does not take effect for third-party applications. The value true means that the application will start during the OS startup and keep alive. If the application process exits, the OS will restart it.BooleanYes (initial value: false)
supportBackupWhether the application supports backup and restoration. The value false means that the application does not support backup or restoration.BooleanYes (initial value: false)
compressNativeLibsDuring HAP packaging, whether the libs libraries are packaged to HAP after being compressed.
- true: The libs libraries are packaged in the HAP file after being compressed.
- false: The libs libraries are stored without being compressed.
During application installation, whether the libs library needs to be decompressed. (Since API version 16, this field is supported. In earlier versions, the libs library is decompressed by default.)
- true: The libs library is decompressed.
- false: The libs library is not decompressed.
BooleanYes (During HAP packaging, initial value: false; during application installation, initial value: true)
networkNetwork security configuration. You can customize the network security settings of the application in the security statement of the configuration file without modifying the application code.ObjectYes (initial value: left empty)

Internal Structure of the network Attribute

Table 3 Internal structure of the network attribute

NameDescriptionData TypeInitial Value Allowed
cleartextTrafficWhether to allow the application to use plaintext traffic, for example, plaintext HTTP traffic.
- true: The application is allowed to use plaintext traffic.
- false: The application is not allowed to use plaintext traffic.
BooleanYes (initial value: false)
securityConfigNetwork security configuration of the application.ObjectYes (initial value: left empty)

Internal Structure of the securityConfig Attribute

Table 4 Internal structure of the securityConfig attribute

NameDescriptionData TypeInitial Value Allowed
domainSettingsSecurity settings of the custom network domain. This attribute allows nested domains. That is, the domainSettings object of a network domain can be nested with the domainSettings objects of smaller network domains.ObjectYes (initial value: left empty)

Internal Structure of the domainSettings Attribute

Table 5 Internal structure of the domainSettings attribute

NameDescriptionData TypeInitial Value Allowed
cleartextPermittedWhether cleartext is allowed in the custom network domain. If both cleartextTraffic and security are declared, whether cleartext is allowed in the custom network domain is determined by cleartextPermitted.
- true: Cleartext is allowed.
- false: Cleartext is not allowed.
BooleanYes (initial value: left empty)
domainsDomain name. This attribute consists of two sub-attributes: subdomains and name.
- subdomains (boolean): specifies whether the domain name contains subdomains. If it is set to true, the domain naming convention applies to all related domains and subdomains (including the lower-level domains of the subdomains). Otherwise, the convention applies only to exact matches.
- name (string): indicates the domain name.
Object arrayYes (initial value: left empty)

Example of the deviceConfig tag:

"deviceConfig": {
  "default": {
    "process": "com.example.test.example",
    "supportBackup": false,
    "network": {
      "cleartextTraffic": true,
      "securityConfig": {
        "domainSettings": {
          "cleartextPermitted": true,
          "domains": [
            {
              "subdomains": true,
              "name": "example.ohos.com"
            }
          ]
        }
      }
    }
  }
}

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Quick Start

harmony 鸿蒙Creating an Application Clone

harmony 鸿蒙app.json5 Configuration File

harmony 鸿蒙Structure of the app Tag

harmony 鸿蒙Overview of Application Configuration Files in FA Model

harmony 鸿蒙Overview of Application Configuration Files in Stage Model

harmony 鸿蒙Application Installation, Uninstall, and Update

harmony 鸿蒙Application Package Overview

harmony 鸿蒙Application Package Structure in FA Model

harmony 鸿蒙Application Package Structure in Stage Model

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