This is the fifth day of my participation in the More text Challenge. For details, see more text Challenge
Hongmeng OS, environment setup and the first program Hello World
User application
User applications are generally referred to as applications that run on the operating system of a device and provide specific services for users.
Apps that run on HarmonyOS come in two forms:
- Traditional applications that need to be installed.
- Provide specific functionality, install – free applications (i.e., atomization services).
In the HarmonyOS documentation, an “application” refers to an object that includes both of these forms unless otherwise specified.
User application package structure
The HarmonyOS user Application Package is released as the APP Pack, which consists of one or more Haps (HarmonyOS Ability Package) and pack.info that describes the properties of each HAP. HAP is the deployment package for Ability, and the HarmonyOS application code is centered around the Ability component.
An HAP is a module package composed of code, resources, third-party libraries and application configuration files, which can be divided into two module types, entry and feature, as shown in Figure 1.
- Entry: main module of the application. In an APP, there must be only one ENTRY type HAP for the same device type, which can be installed and run independently.
- Feature: The dynamic feature module of the application. An APP can contain one or more Haps of feature type or none. Only HAP containing Ability can run independently.
Ability
Ability is an abstraction of the Ability of an application. An application can contain one or more abilities. Ability can be divided into two types: FA (Feature Ability) and PA (Particle Ability). FA/PA is the basic building block of an application that enables specific business functions to be implemented. FA has a UI, PA has no UI.
The library files
Library files are third-party code (such as SO, JAR, bin, HAR, and other binary files) that the application depends on and are stored in the libs directory.
Resource file
Application resource files (strings, images, audio, etc.) are stored in the resources directory, which is easy for developers to use and maintain. See the classification of resource files for details.
The configuration file
A configuration file (config.json) is the Ability information of an application, which is used to declare the Ability and permissions required by an application. For details, see an application configuration file.
pack.info
Describes the attributes of each HAP in the application package, compiled by the IDE, and unpacked and categorized by the application market according to the file. HAP specific attributes include:
- Delivery-with-install: indicates whether HAP can be installed with the application. True: Supports installation along with the application. False: indicates that the installation is not supported along with the application.
- Name: indicates the HAP file name.
- Module-type: indicates the module type, such as entry or feature.
- Device-type: indicates the type of the device that supports HAP running.
HAR
HAR (HarmonyOS Ability Resources) provides everything you need to build your application, including source code, resource files, and config.json files. HAR is different from HAP in that HAR cannot be installed and run independently on the device and can only be referenced as a dependency of the application module.
The configuration file
There is a config file “config.json” in the root directory of each HAP application. The content of the file mainly covers the following three aspects:
- Global configuration information about an application, including the package name, manufacturer, and version.
- Application configuration information on a specific device, including application backup and restoration, and network security.
- HAP package configuration information, including the basic properties that each Ability must define (such as package name, class name, type, and capabilities provided by Ability), as well as the permissions the application needs to access the system or other protected parts of the application.
Composition of a configuration file
The configuration file config.json adopts the JSON file format and contains a series of configuration items. Each configuration item consists of attributes and values.
-
attribute
Attributes appear in no particular order, and each attribute is allowed to appear at most once.
-
value
The value of each property is a basic JSON data type (numeric, string, Boolean, array, object, or NULL). If attribute values need to refer to resource files, see Resource Files.
Public number: Android development programming hongmeng development documents and environment building tutorial