提交 7ef5fcc1 编写于 作者: W wuyongning

Merge branch 'OpenHarmony-3.1-Release' of https://gitee.com/wuyongning/docs...

Merge branch 'OpenHarmony-3.1-Release' of https://gitee.com/wuyongning/docs into OpenHarmony-3.1-Release

要显示的变更太多。

To preserve performance only 1000 of 1000+ files are displayed.
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
master:最新开发版本。 master:最新开发版本。
发布OpenHarmony 3.1 Beta版本,[了解版本详情](zh-cn/release-notes/OpenHarmony-v3.1-beta.md) 发布OpenHarmony 3.1 Release版本,[了解版本详情](zh-cn/release-notes/OpenHarmony-v3.1-release.md)
发布OpenHarmony 3.0 LTS版本,[了解版本详情](zh-cn/release-notes/OpenHarmony-v3.0-LTS.md)。该版本已更新至OpenHarmony 3.0.2 LTS,[了解版本详情](zh-cn/release-notes/OpenHarmony-v3.0.2-LTS.md) 发布OpenHarmony 3.0 LTS版本,[了解版本详情](zh-cn/release-notes/OpenHarmony-v3.0-LTS.md)。该版本已更新至OpenHarmony 3.0.2 LTS,[了解版本详情](zh-cn/release-notes/OpenHarmony-v3.0.2-LTS.md)
......
# Ability Development # Ability Development
- [Ability Framework Overview](ability-brief.md) - [FA Model Overview](fa-brief.md)
- FA Model - [Page Ability Development](fa-pageability.md)
- [FA Model Overview](fa-brief.md) - [Service Ability Development](fa-serviceability.md)
- [Page Ability Development](fa-pageability.md) - [Data Ability Development](fa-dataability.md)
- [Service Ability Development](fa-serviceability.md) - [FA Widget Development](fa-formability.md)
- [Data Ability Development](fa-dataability.md)
- [FA Widget Development](fa-formability.md)
- Other - Other
- [Ability Assistant Usage](ability-assistant-guidelines.md) - [Ability Assistant Usage](ability-assistant-guidelines.md)
# Ability Framework Overview
An ability is an abstraction of a functionality that an application can provide. It is the minimum unit for the system to schedule applications. An application can contain one or more **Ability** instances.
The ability framework model has two forms. The first form is the FA model, which applies to application development using API 8 and earlier versions. In the FA model, there are Feature Ability (FA) and Particle Ability (PA). The FA supports Page abilities, and the PA supports Service and Data abilities. The stage model is introduced since API 9. In the stage model, there are Page abilities and Extension abilities. The Extension ability is further extended to Service Extension, Form Extension, Data Share Extension, and more.
The stage model is designed to make complex application development easier in a distributed environment. The two models have differences in the following aspects:
* Ability type and API usage
![favsstage](figures/favsstage.png)
* Ability lifecycle
![lifecycle](figures/lifecycle.png)
* Application configuration files and application package structure (The differences are reflected in the application packages generated by the IDE.)
For details about the two models, see [FA Model Overview](fa-brief.md) and [Stage Model Overview](stage-brief.md).
# Ability Continuation Development
## When to Use
With ability continuation APIs, you can migrate the current application task, including some page data and stack information, to a remote device. If the migration is successful, the local task will be cleared. If the migration fails, the local task can be migrated again.
## Available APIs
The following table lists the API used for ability continuation. For details about the API, see the interface document.
**Table 1** Ability continuation API
|API| Description|
|:------ | :------|
| onContinue(wantParams : {[key: string]: any}) | A callback used to store the data required for migration and indicate whether the migration is accepted. The value **true** means that the migration is accepted, and **false** means the opposite.|
## How to Develop
### Migrating an Ability
1. Configure data.
- Configure the ability to support migration.
​ Set the **continuable** field in the **config.json** file to **true**, which indicates that migration is supported. The default value is **false**.
```
"continuable": true
```
Abilities with the **continuable** field set to **false** cannot be migrated.
* Configure the ability startup type.
​ Currently, only multi-instance abilities can be migrated. Therefore, you must set the **launchType** field in the **config.json** file to **standard**.
```
"launchType": "standard"
```
2. Implement the **onContinue** API.
Modules to Import
```
import Ability from '@ohos.application.Ability';
```
- To implement migration, you must implement this API and have the value **true** returned.
- Example
```javascript
onContinue(wantParams : {[key: string]: any}) {
console.log("MainAbility onContinue")
return true;
}
```
3. Implement the migration logic in the **onCreate** API.
- On the remote device, determine whether the startup is **LaunchReason.CONTINUATION** (3) based on **launchReason** in **onCreate**.
- After data restore is complete, call **restoreWindowStage** to trigger page restoration.
* Example
```javascript
onCreate(want , launchParam) {
// The ability is being created. Initialize resources for this ability.
console.log("MainAbility onCreate", launchParam.launchReason);
if (launchParam.launchReason == LaunchReason.CONTINUATION) {
this.contentStorage = new ContenStorage();
this.context.restoreWindowStage(this.contentStorage);
}
}
```
### Migrating Data
1. Use custom data.
- You can fill custom data in the key-value format in the **wantParams** parameter, through which the data will be transferred to the remote device. The **key** type is string, and therefore it is used to carry simple and lightweight data.
```javascript
onContinue(wantParams : {[key: string]: any}) {
console.log("Continue My Data")
wantParams["myData"] = "my1234567";
return true;
}
```
- If the remote device detects a migration, it obtains the custom data saved at the initiator from **want.parameters**.
```javascript
onCreate(want , launchParam) {
if (launchParam.launchReason == LaunchReason.CONTINUATION) {
console.log("onCreate LaunchReason = CONTINUATION",want.parameters["myData"]); // my1234567
...
this.context.restoreWindowStage(this.contentStorage);
}
}
```
2. Use distributed objects.
You can use distributed objects to transfer more data to a remote device. For details, see the distributed object interface document.
- In **onContinue**, the initiator saves the data to be migrated to the distributed object, sets the session ID, and sends the session ID to the remote device through **wantParams**.
- The remote device obtains the session ID from **onCreate**, creates a distributed object, and associates the distributed object with the session ID. In this way, the distributed object can be synchronized. Before calling **restoreWindowStage**, ensure that all distributed objects required for migration have been associated for correct data retrieval.
* Example
```javascript
import Ability from '@ohos.application.Ability';
import distributedObject from '@ohos.data.distributedDataObject';
var g_object = distributedObject.createDistributedObject({name:undefined});
export default class MainAbility extends Ability {
contentStorage : ContenStorage
sessionId : string;
onCreate(want , launchParam) {
if (launchParam.launchReason == 3) {
this.sessionId = want.parameters["session"] // Obtain the session ID.
function statusCallback(sessionId, networkid, status) {
console.info("object status change sessionId: " + sessionId + " status: " + status +
"g_object.name: " + g_object.name); // The synchronized distributed object content "name = Amy" can be obtained from the callback.
}
g_object.on("status", statusCallback); // Register a callback to listen for the distributed object synchronization result.
g_object.setSessionId(this.sessionId); // Associate the local distributed object with the session ID of the initiator.
this.contentStorage = new ContenStorage();
this.context.restoreWindowStage(this.contentStorage);
}
}
onContinue(wantParams : {[key: string]: any}) {
console.log("using distributedObject")
this.sessionId = "654321";
g_object.setSessionId(this.sessionId); // Set the session ID of the distributed object.
g_object.name = "Amy"; // Fill data.
wantParams["session"] = this.sessionId; // Send the session ID to the remote device through the want object.
return true;
}
```
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
The application development documents provide reference for you to develop applications using the APIs provided by OpenHarmony. The documents provided walk you through how to use JavaScript \(JS\) APIs to develop applications on the standard system. The application development documents provide reference for you to develop applications using the APIs provided by OpenHarmony. The documents provided walk you through how to use JavaScript \(JS\) APIs to develop applications on the standard system.
To get a glimpse of the basic methods for developing applications, see [Basics](quick-start/Readme-EN.md). For details about the API list and references, see [Reference](reference/Readme-EN.md). To get a glimpse of the basic methods for developing applications, see [Basics](quick-start/start-overview.md). For details about the API list and references, see [Reference](reference/apis/js-apis-featureAbility.md).
To better understand frequently used modules, see the development guidelines for [UI](ui/Readme-EN.md), [Media](media/Readme-EN.md), and [Connectivity](connectivity/Readme-EN.md). To better understand frequently used modules, see the development guidelines for [Ability](ability/fa-brief.md), [UI](ui/arkui-overview.md), [Media](media/Readme-EN.md), etc.
For details about the principles and basic information of each subsystem, see the README file in **docs/en/readme**. For details about the principles and basic information of each subsystem, see the README file in **docs/en/readme**.
...@@ -563,12 +563,12 @@ Publish a 10-second countdown reminder. ...@@ -563,12 +563,12 @@ Publish a 10-second countdown reminder.
} }
], ],
wantAgent: { wantAgent: {
pkgName: "com.example.phone", pkgName: "com.example.device",
abilityName: "com.example.phone.MainAbility" abilityName: "com.example.device.MainAbility"
}, },
maxScreenWantAgent: { maxScreenWantAgent: {
pkgName: "com.example.phone", pkgName: "com.example.device",
abilityName: "com.example.phone.MainAbility" abilityName: "com.example.device.MainAbility"
}, },
title: "this is title", title: "this is title",
content: "this is content", content: "this is content",
...@@ -625,12 +625,12 @@ calendar: { ...@@ -625,12 +625,12 @@ calendar: {
}, },
], ],
wantAgent: { wantAgent: {
pkgName: "com.example.phone", pkgName: "com.example.device",
abilityName: "com.example.phone.MainAbility" abilityName: "com.example.device.MainAbility"
}, },
maxScreenWantAgent: { maxScreenWantAgent: {
pkgName: "com.example.phone", pkgName: "com.example.device",
abilityName: "com.example.phone.MainAbility" abilityName: "com.example.device.MainAbility"
}, },
ringDuration: 5, ringDuration: 5,
snoozeTimes: 2, snoozeTimes: 2,
...@@ -663,12 +663,12 @@ alarm: { ...@@ -663,12 +663,12 @@ alarm: {
}, },
], ],
wantAgent: { wantAgent: {
pkgName: "com.example.phone", pkgName: "com.example.device",
abilityName: "com.example.phone.MainAbility" abilityName: "com.example.device.MainAbility"
}, },
maxScreenWantAgent: { maxScreenWantAgent: {
pkgName: "com.example.phone", pkgName: "com.example.device",
abilityName: "com.example.phone.MainAbility" abilityName: "com.example.device.MainAbility"
}, },
ringDuration: 5, ringDuration: 5,
snoozeTimes: 2, snoozeTimes: 2,
......
# IPC & RPC<a name="EN-US_TOPIC_0000001157385969"></a>
- **[IPC & RPC Overview](ipc-rpc-overview.md)**
- **[IPC & RPC Development Guidelines](ipc-rpc-development-guideline.md)**
- **[Subscribing to State Changes of a Remote Object](subscribe-remote-state.md)**
...@@ -7,3 +7,9 @@ ...@@ -7,3 +7,9 @@
- [Location Overview](device-location-overview.md) - [Location Overview](device-location-overview.md)
- [Obtaining Device Location Information](device-location-info.md) - [Obtaining Device Location Information](device-location-info.md)
- [Geocoding and Reverse Geocoding Capabilities](device-location-geocoding.md) - [Geocoding and Reverse Geocoding Capabilities](device-location-geocoding.md)
- Sensor
- [Sensor Overview](sensor-overview.md)
- [Sensor Development](sensor-guidelines.md)
- Vibrator
- [vibrator-Overview.md](vibrator-overview.md)
- [Vibrator Development](vibrator-guidelines.md)
\ No newline at end of file
# Sensor Overview # Sensor Overview
Sensors in OpenHarmony are an abstraction of underlying hardware-based sensors. Your application can access the underlying sensors via OpenHarmony sensors. Using the APIs provided by OpenHarmony sensors, you can query sensors on your device, subscribe to sensor data, customize algorithms based on sensor data, and develop various sensor-based applications, such as compass, fitness and health, and games applications. Sensors in OpenHarmony are an abstraction of underlying hardware-based sensors. Your application can access the underlying sensors via the sensors. Using the APIs provided by sensors, you can query sensors on your device, subscribe to sensor data, customize algorithms based on sensor data, and develop various sensor-based applications, such as compass, fitness and health, and games applications.
The sensors are classified into the following categories based on their functions: motion, environment, orientation, light, body, and other categories (such as Hall effect sensors). Each category includes different sensor types. A sensor type may be a single physical sensor or a composite of multiple physical sensors. A sensor is a device to detect events or changes in an environment and send messages about the events or changes to another device (for example, a CPU). Generally, a sensor is composed of sensitive components and conversion components. Sensors are the cornerstone of the IoT. A unified sensor management framework is required to achieve data sensing at a low latency and low power consumption, thereby keeping up with requirements of "1+8+N" products or business in the Seamless AI Life Strategy. The sensor list is as follows:
| Sensor Type | Sensor Name | Description | Usage |
| --------------------------------------- | ------------------ | ------------------------------------------------------------ | ---------------------------------------- |
| SENSOR_TYPE_ACCELEROMETER | Acceleration sensor | Measures the acceleration (including the gravity acceleration) applied to a device on three physical axes (X, Y, and Z), in the unit of m/s<sup>2</sup>.| Detecting the motion status |
| SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED | Uncalibrated acceleration sensor| Measures the uncalibrated acceleration (including the gravity acceleration) applied to a device on three physical axes (X, Y, and Z), in the unit of m/s<sup>2</sup>.| Measuring the acceleration bias estimation |
| SENSOR_TYPE_LINEAR_ACCELERATION | Linear acceleration sensor | Measures the linear acceleration (excluding the gravity acceleration) applied to a device on three physical axes (X, Y, and Z), in the unit of m/s<sup>2</sup>.| Detecting the linear acceleration in each axis |
| SENSOR_TYPE_GRAVITY | Gravity sensor | Measures the gravity acceleration applied to a device on three physical axes (X, Y, and Z), in the unit of m/s<sup>2</sup>.| Measuring the gravity |
| SENSOR_TYPE_GYROSCOPE | Gyroscope sensor | Measures the rotation angular velocity of a device on three physical axes (X, Y, and Z), in the unit of rad/s.| Measuring the rotation angular velocity |
| SENSOR_TYPE_GYROSCOPE_UNCALIBRATED | Uncalibrated gyroscope sensor| Measures the uncalibrated rotation angular velocity of a device on three physical axes (X, Y, and Z), in the unit of rad/s.| Measuring the bias estimation of the rotation angular velocity |
| SENSOR_TYPE_SIGNIFICANT_MOTION | Significant motion sensor | Checks whether a device has a significant motion on three physical axes (X, Y, and Z). The value **0** means that the device does not have a significant motion, and **1** means the opposite.| Detecting significant motions of a device |
| SENSOR_TYPE_PEDOMETER_DETECTION | Pedometer detection sensor | Detects whether a user takes a step. The value can be **0** (the user does not take a step) or **1** (the user takes a step).| Detecting whether a user takes a step |
| SENSOR_TYPE_PEDOMETER | Pedometer sensor | Records the number of steps a user has walked. | Providing the number of steps a user has walked |
| SENSOR_TYPE_AMBIENT_TEMPERATURE | Ambient temperature sensor | Measures the ambient temperature, in the unit of degree Celsius (°C). | Measuring the ambient temperature |
| SENSOR_TYPE_MAGNETIC_FIELD | Magnetic field sensor | Measures the magnetic field on three physical axes (X, Y, and Z), in the unit of μT.| Creating a compass |
| SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED | Uncalibrated magnetic field sensor | Measures the uncalibrated magnetic field on three physical axes (X, Y, and Z), in the unit of μT.| Measuring the magnetic field bias estimation |
| SENSOR_TYPE_HUMIDITY | Humidity sensor | Measures the ambient relative humidity, in a percentage (%). | Monitoring the dew point, absolute humidity, and relative humidity |
| SENSOR_TYPE_BAROMETER | Barometer sensor | Measures the barometric pressure, in the unit of hPa or mbar. | Measuring the barometric pressure |
| SENSOR_TYPE_ORIENTATION | Orientation sensor | Measures the rotation angles of a device on three physical axes (X, Y, and Z), in the unit of rad.| Providing the three orientation angles of the screen |
| SENSOR_TYPE_ROTATION_VECTOR | Rotation vector sensor | Measures the rotation vector of a device. It is a composite sensor that generates data from the acceleration sensor, magnetic field sensor, and gyroscope sensor.| Detecting the orientation of a device in the East, North, Up (ENU) Cartesian coordinate system |
| SENSOR_TYPE_PROXIMITY | Proximity sensor | Measures the distance between a visible object and the device screen. | Measuring the distance between a person and the device during a call |
| SENSOR_TYPE_AMBIENT_LIGHT | Ambient light sensor | Measures the ambient light intensity of a device, in the unit of lux. | Automatically adjusting the screen brightness and checking whether the screen is covered on the top|
| SENSOR_TYPE_HEART_RATE | Heart rate sensor | Measures the heart rate of a user. | Providing users' heart rate data |
| SENSOR_TYPE_WEAR_DETECTION | Wear detection sensor | Checks whether a user is wearing a wearable device. | Detecting wearables |
| SENSOR_TYPE_HALL | Hall effect sensor | Detects a magnetic field around a device. | Smart cover mode of the device |
**Table1** Motion - ohos.sensor.agent.CategoryMotionAgent
| Sensor Type | Sensor Name | Description | Usage | ## Working Principles
| -------- | -------- | -------- | -------- |
| SENSOR_TYPE_ACCELEROMETER | Acceleration sensor | Measures the acceleration (including the gravity acceleration) applied to a device on three physical axes (X, Y, and Z), in the unit of m/s<sup>2</sup>. | Detecting the motion status |
| SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED | Uncalibrated acceleration sensor | Measures the uncalibrated acceleration (including the gravity acceleration) applied to a device on three physical axes (X, Y, and Z), in the unit of m/s<sup>2</sup>. | Measuring the acceleration bias estimation |
| SENSOR_TYPE_LINEAR_ACCELERATION | Linear acceleration sensor | Measures the linear acceleration (excluding the gravity acceleration) applied to a device on three physical axes (X, Y, and Z), in the unit of m/s<sup>2</sup>. | Detecting the linear acceleration in each axis |
| SENSOR_TYPE_GRAVITY | Gravity sensor | Measures the gravity acceleration applied to a device on three physical axes (X, Y, and Z), in the unit of m/s<sup>2</sup>. | Measuring the gravity |
| SENSOR_TYPE_GYROSCOPE | Gyroscope sensor | Measures the rotation angular velocity of a device on three physical axes (X, Y, and Z), in the unit of rad/s. | Measuring the rotation angular velocity |
| SENSOR_TYPE_GYROSCOPE_UNCALIBRATED | Uncalibrated gyroscope sensor | Measures the uncalibrated rotation angular velocity of a device on three physical axes (X, Y, and Z), in the unit of rad/s. | Measuring the bias estimation of the rotation angular velocity |
| SENSOR_TYPE_SIGNIFICANT_MOTION | Significant motion sensor | Checks whether a device has a significant motion on three physical axes (X, Y, and Z). The value can be **0** (having no significant motion) or **1** (having a significant motion). | Detecting significant motions of a device |
| SENSOR_TYPE_DROP_DETECTION | Drop detection sensor | Detects the device drop status. The value can be **0** (the device is not dropped) or **1** (the device is dropped). | Detecting whether a device is dropped |
| SENSOR_TYPE_PEDOMETER_DETECTION | Pedometer detection sensor | Detects whether a user takes a step. The value can be **0** (the user does not take a step) or **1** (the user takes a step). | Detecting whether a user takes a step |
| SENSOR_TYPE_PEDOMETER | Pedometer sensor | Records the number of steps a user has walked. | Providing the number of steps a user has walked |
The following modules work cooperatively to implement OpenHarmony sensors: Sensor API, Sensor Framework, Sensor Service, and HDF layer.
**Table2** Environment - ohos.sensor.agent.CategoryOrientationAgent **Figure 1** How the sensor works
| Sensor Type | Sensor Name | Description | Usage | ![fad1a124-a90e-460f-84fc-e87d6caebb21](figures/fad1a124-a90e-460f-84fc-e87d6caebb21.png)
| -------- | -------- | -------- | -------- |
| SENSOR_TYPE_AMBIENT_TEMPERATURE | Ambient temperature sensor. | Measures the ambient temperature, in the unit of degree Celsius (°C). | Measuring the ambient temperature |
| SENSOR_TYPE_MAGNETIC_FIELD | Magnetic field sensor | Measures the magnetic field on three physical axes (X, Y, and Z), in the unit of μT. | Creating a compass |
| SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED | Uncalibrated magnetic field sensor | Measures the uncalibrated magnetic field on three physical axes (X, Y, and Z), in the unit of μT. | Measuring the magnetic field bias estimation |
| SENSOR_TYPE_HUMIDITY | Humidity sensor | Measures the ambient relative humidity, in a percentage (%). | Monitoring the dew point, absolute humidity, and relative humidity |
| SENSOR_TYPE_BAROMETER | Barometer sensor | Measures the barometric pressure, in the unit of hPa or mbar. | Measuring the barometric pressure |
| SENSOR_TYPE_SAR | Specific Absorption Rate (SAR) sensor | Measures the SAR, in the unit of W/kg. | Measuring the SAR of electromagnetic waves for a device |
**Table3** Orientation - ohos.sensor.agent.CategoryOrientationAgent
| Sensor Type | Sensor Name | Description | Usage |
| -------- | -------- | -------- | -------- |
| SENSOR_TYPE_6DOF | Degrees of Freedom (DoF) sensor | Measures the forward/backward, up/down, and left/right translational movement of a device on the three axes (X, Y, and Z) in the unit of m or mm as well as the roll, pitch, and yaw rotation angles on the three axes (X, Y, and Z) in the unit of rad. | Positioning an object by detecting its freedom of translational and rotational motions, for example, VR |
| SENSOR_TYPE_SCREEN_ROTATION | Screen rotation sensor | Checks the rotation status of the device screen. | Detecting whether the device screen is rotating |
| SENSOR_TYPE_DEVICE_ORIENTATION | Device orientation sensor | Measures the rotation angles of the device, in the unit of rad. | Measuring the angles that a device has rotated |
| SENSOR_TYPE_ORIENTATION | Orientation sensor | Measures the rotation angles of a device on three physical axes (X, Y, and Z), in the unit of rad. | Providing the three orientation angles of the screen |
| SENSOR_TYPE_ROTATION_VECTOR | Rotation vector sensor | Measures the rotation vector of a device. It is a composite sensor that generates data from the acceleration sensor, magnetic field sensor, and gyroscope sensor. | Detecting the orientation of a device in the East, North, Up (ENU) Cartesian coordinate system |
| SENSOR_TYPE_GAME_ROTATION_VECTOR<br/>SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR | Game rotation vector sensor<br/>Geomagnetic rotation vector sensor | Measures the game rotation vector of a device. It is a composite sensor that generates data from the acceleration sensor and gyroscope sensor.<br/>Measures the geomagnetic rotation vector of a device. It is a composite sensor that generates data from the acceleration sensor and magnetic field sensor. | Applied in games<br/>Measuring the geomagnetic rotation vector |
**Table4** Light - ohos.sensor.agent.CategoryLightAgent
| Sensor Type | Sensor Name | Description | Usage |
| -------- | -------- | -------- | -------- |
| SENSOR_TYPE_PROXIMITY | Proximity sensor | Measures the distance between a visible object and the device screen. | Measuring the distance between a person and the device during a call |
| SENSOR_TYPE_TOF | Time of flight (ToF) sensor | Measures the time required for light to travel a distance in the medium. | Facial recognition |
| SENSOR_TYPE_AMBIENT_LIGHT | Ambient light sensor | Measures the ambient light intensity of a device, in the unit of lux. | Automatically adjusting the screen brightness and checking whether the screen is covered on the top |
| SENSOR_TYPE_COLOR_TEMPERATURE | Color temperature sensor | Measures the ambient color temperature. | Image processing on the device |
| SENSOR_TYPE_COLOR_RGB | RGB color sensor | Measures the ambient RGB color values. | Color detection implemented by the reflectance of RGB colors |
| SENSOR_TYPE_COLOR_XYZ | XYZ color sensor | Measures the ambient XYZ color values. | Identifying true-color spots to reproduce more natural colors |
**Table5** Body - ohos.sensor.agent.CategoryBodyAgent
| Sensor Type | Sensor Name | Description | Usage |
| -------- | -------- | -------- | -------- |
| SENSOR_TYPE_HEART_RATE | Heart rate sensor | Measures the heart rate of a user. | Providing users' heart rate data |
| SENSOR_TYPE_WEAR_DETECTION | Wear detection sensor | Checks whether a user is wearing a wearable device. | Detecting wearables |
**Table6** Others
| Sensor Type | Sensor Name | Description | Usage |
| -------- | -------- | -------- | -------- |
| SENSOR_TYPE_HALL | Hall effect sensor | Detects a magnetic field around a device. | Smart cover mode of the device |
| SENSOR_TYPE_GRIP_DETECTOR | Grip detection sensor | Detects grip force applied on a device. | Detecting whether the device is gripped on its sides |
| SENSOR_TYPE_MAGNET_BRACKET | Magnet bracket sensor | Checks whether a device is magnetized. | Detecting an in-vehicle or indoor device |
| SENSOR_TYPE_PRESSURE_DETECTOR | Pressure detection sensor | Detects pressure force applied on a device. | Detecting pressure on the top of the device |
## How a Service Is Shared Using Huawei Share
The following modules work cooperatively to implement OpenHarmony sensors: Sensor API, Sensor Framework, Sensor Service, and HD_IDL.
**Figure1** Working principles for OpenHarmony sensors
![en-us_image_0000001226521897](figures/en-us_image_0000001226521897.png)
- Sensor API: provides APIs for performing basic operations on sensors, including querying the sensor list, subscribing to or unsubscribing from sensor data, and executing control commands. This module makes application development simpler. - Sensor API: provides APIs for performing basic operations on sensors, including querying the sensor list, subscribing to or unsubscribing from sensor data, and executing control commands. This module makes application development simpler.
...@@ -90,22 +45,22 @@ The following modules work cooperatively to implement OpenHarmony sensors: Senso ...@@ -90,22 +45,22 @@ The following modules work cooperatively to implement OpenHarmony sensors: Senso
- Sensor Service: interacts with the HD_IDL module to receive, parse, and distribute data, manages foreground and background policies and sensors of a device, and controls sensor permissions. - Sensor Service: interacts with the HD_IDL module to receive, parse, and distribute data, manages foreground and background policies and sensors of a device, and controls sensor permissions.
- HD_IDL: selects proper policies based on the hardware first in first out (FIFO) and frequency, and adapts to different devices. - HDF layer: selects proper policies based on the hardware first in first out (FIFO) and frequency, and adapts to different devices.
## Limitations and Constraints ## Constraints
To obtain data of the following sensors, you must claim the required permissions. 1. To obtain data of the following sensors, you must claim the required permissions.
Table 7 Sensor data permissions
**Table7** Sensor data permission | Sensor | Permission | Sensitivity | Permission Description |
| ------------------------- | -------------------------------- | ------------ | ----------------------- |
| Acceleration sensor, uncalibrated acceleration sensor, and linear acceleration sensor| ohos.permission.ACCELEROMETER | system_grant | Allows your application to subscribe to data of these acceleration-related sensors in the motion category.|
| Gyroscope sensor and uncalibrated gyroscope sensor | ohos.permission.GYROSCOPE | system_grant | Allows an application to subscribe to data of the gyroscope-related sensors in the motion category.|
| Pedometer sensor | ohos.permission.ACTIVITY_MOTION | user_grant | Allows an application to subscribe to the motion status. |
| Heart rate sensor | ohos.permission.READ_HEALTH_DATA | user_grant | Allows an application to read health data. |
| Sensor | Permission Name | Sensitivity | Permission Description |
| -------- | -------- | -------- | -------- |
| Acceleration sensor, uncalibrated acceleration sensor, and linear acceleration sensor | ohos.permission.ACCELEROMETER | system_grant | Allows your application to subscribe to data of these acceleration-related sensors in the motion category. |
| Gyroscope sensor and uncalibrated gyroscope sensor | ohos.permission.GYROSCOPE | system_grant | Allows your application to subscribe to data of these gyroscope-related sensors in the motion category. |
| Pedometer sensor | ohos.permission.ACTIVITY_MOTION | user_grant | Allows your application to subscribe to the motion status. |
| Heart rate sensor | ohos.permission.READ_HEALTH_DATA | user_grant | Allows your application to read health data. |
The APIs for subscribing to and unsubscribing from sensor data work in pairs. If you do not need sensor data, call the unsubscription API to stop sensor data reporting. 2. The APIs for subscribing to and unsubscribing from sensor data work in pairs. If you do not need sensor data, call the unsubscription API to stop sensor data reporting.
# Vibrator Development
## When to Use
You can set different vibration effects as needed, for example, customizing vibration effects with different intensities and durations for buttons on the device, and customizing one-shot or periodic vibration effects with different intensities and durations for alarm clocks and incoming calls.
## Available APIs
| Module | API | Description |
| -------- | -------- | -------- |
| ohos.vibrator | vibrate(duration:&nbsp;number):&nbsp;Promise&lt;void&gt; | Triggers&nbsp;vibration&nbsp;with&nbsp;the&nbsp;specified&nbsp;duration.&nbsp;This&nbsp;API&nbsp;uses&nbsp;a&nbsp;promise&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| ohos.vibrator | vibrate(duration:&nbsp;number,&nbsp;callback?:&nbsp;AsyncCallback&lt;void&gt;):&nbsp;void | Triggers&nbsp;vibration&nbsp;with&nbsp;the&nbsp;specified&nbsp;duration.&nbsp;This&nbsp;API&nbsp;uses&nbsp;a&nbsp;callback&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| ohos.vibrator | vibrate(effectId:&nbsp;EffectId):&nbsp;Promise&lt;void&gt; | Triggers&nbsp;vibration&nbsp;with&nbsp;the&nbsp;specified&nbsp;effect.&nbsp;This&nbsp;API&nbsp;uses&nbsp;a&nbsp;promise&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| ohos.vibrator | vibrate(effectId:&nbsp;EffectId,&nbsp;callback?:&nbsp;AsyncCallback&lt;void&gt;):&nbsp;void | Triggers&nbsp;vibration&nbsp;with&nbsp;the&nbsp;specified&nbsp;effect.&nbsp;This&nbsp;API&nbsp;uses&nbsp;a&nbsp;callback&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| ohos.vibrator | stop(stopMode:&nbsp;VibratorStopMode):&nbsp;Promise&lt;void&gt; | Stops&nbsp;vibration.&nbsp;This&nbsp;API&nbsp;uses&nbsp;a&nbsp;promise&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
| ohos.vibrator | stop(stopMode:&nbsp;VibratorStopMode,&nbsp;callback?:&nbsp;AsyncCallback&lt;void&gt;):&nbsp;void | Stops&nbsp;vibration.&nbsp;This&nbsp;API&nbsp;uses&nbsp;a&nbsp;callback&nbsp;to&nbsp;return&nbsp;the&nbsp;result. |
## How to Develop
1. Declare the permissions required for controlling vibrators on the hardware device in the **config.json** file.
```
"reqPermissions":[
{
"name":"ohos.permission.ACCELEROMETER",
"reason"":"",
"usedScene":{
"ability""[
".MainAbility"
],
"when":"inuse"
}
},
{
"name":"ohos.permission.VIBRATE",
"reason"":"",
"usedScene":{
"ability""[
".MainAbility"
],
"when":"inuse"
}
},
{
"name":"ohos.permission.ACTIVITY_MOTION",
"reason"":"",
"usedScene":{
"ability""[
".MainAbility"
],
"when":"inuse"
}
},
]
```
2. Trigger the device to vibrate.
```
import vibrator from "@ohos.vibrator"
vibrator.vibrate(duration: number).then((error)=>{
if(error){// The call fails, and error.code and error.message are printed.
console.log("Promise return failed.error.code"+error.code+"error.message"+error.message);
}else{// The call succeeded. The device starts to vibrate.
console.log("Promise returned to indicate a successful vibration.")
};
})
```
3. Stop the vibration.
```
import vibrator from "@ohos.vibrator"
vibrator.stop(stopMode: VibratorStopMode).then((error)=>{
if(error){// The call fails, and error.code and error.message are printed.
console.log("Promise return failed. error.code"+error.code+"error.message"+error.message);
}else{// The call succeeded. The device stops vibration.
Console.log("Promise returned to indicate a successful stop.");
};
})
```
# Vibrator Overview
The vibrator service opens up the latest capabilities of the vibrator hardware to the maximum extent. By expanding the native vibrator service to implement integrated vibration and interaction design, the service delivers an exquisite integrated vibration experience and differentiated experience, and improves user interaction efficiency and usability.
## Working Principles
The vibrator is a Misc device that consists of four modules: Vibrator API, Vibrator Framework, Vibrator Service, and HD_IDL.
**Figure1** Vibrator in Misc devices
![en-us_image_0000001180249428](figures/en-us_image_0000001180249428.png)
- Vibrator API: provides basic vibrator APIs, including the APIs for querying the vibrator list, querying the vibrator by effect, and triggering and stopping vibration.
- Vibrator Framework: manages the framework layer of the vibrator and communicates with the Misc Device Service.
- Vibrator Service: manages services of vibrators.
- HD_IDL: adapts to different devices.
## Constraints
When using a vibrator, you need to declare and obtain the **ohos.permission.VIBRATE** permission first so that you can control the vibration effect.
# Internationalization
- [Overview](international-overview.md)
- [Internationalization Development (intl)](intl-guidelines.md)
- [Internationalization Development (i18n)](i18n-guidelines.md)
# Internationalization Development (i18n)
## Obtaining System Language and Region Information
APIs are provided to access the system language and region information.
### Available APIs
| Module | API | Description |
| -------- | -------- | -------- |
| ohos.i18n | getSystemLanguage(): string | Obtains the system language. |
| ohos.i18n | getSystemRegion(): string | Obtains the system region. |
| ohos.i18n | getSystemLocale(): string | Obtains the system locale. |
| ohos.i18n | isRTL(locale: string): boolean<sup>7+</sup> | Checks whether the locale uses a right-to-left (RTL) language. |
| ohos.i18n | is24HourClock(): boolean<sup>7+</sup> | Checks whether the system uses a 24-hour clock. |
| ohos.i18n | getDisplayLanguage(language: string, locale: string, sentenceCase?: boolean): string | Obtains the localized display of a language. |
| ohos.i18n | getDisplayCountry(country: string, locale: string, sentenceCase?: boolean): string | Obtains the localized display of a country. |
### How to Develop
1. Obtain the system language.
Call the **getSystemLanguage** method to obtain the system language (**i18n** is the name of the imported module).
```
var language = i18n.getSystemLanguage();
```
2. Obtains the system region.
Call the **getSystemRegion** method to obtain the system region.
```
var region = i18n.getSystemRegion();
```
3. Obtain the system locale.
Call the **getSystemLocale** method to obtain the system locale.
```
var locale = i18n.getSystemLocale();
```
4. Check whether the locale's language is RTL.
Call the **isRTL** method to check whether the locale's language is RTL.
```
var rtl = i18n.isRTL("zh-CN");
```
5. Check whether the system uses a 24-hour clock.
Call the **is24HourClock** method to check whether the system uses a 24-hour clock.
```
var hourClock = i18n.is24HourClock();
```
6. Obtain the localized display of a language.
Call the **getDisplayLanguage** method to obtain the localized display of a language. **language** indicates the language to be localized, **locale** indicates the locale, and **sentenceCase** indicates whether the first letter of the result must be capitalized.
```
var language = "en";
var locale = "zh-CN";
var sentenceCase = false;
var localizedLanguage = i18n.getDisplayLanguage(language, locale, sentenceCase);
```
7. Obtain the localized display of a country.
Call the **getDisplayCountry** method to obtain the localized display of a country. **country** indicates the country to be localized, **locale** indicates the locale, and **sentenceCase** indicates whether the first letter of the result must be capitalized.
```
var country = "US";
var locale = "zh-CN";
var sentenceCase = false;
var localizedCountry = i18n.getDisplayCountry(country, locale, sentenceCase);
```
## Obtaining Calendar Information
[Calendar](../reference/apis/js-apis-intl.md) APIs are used to obtain calendar information, for example, the localized display of the calendar, the first day of a week, and the minimum count of days in the first week of a year.
### Available APIs
| Module | API | Description |
| -------- | -------- | -------- |
| ohos.i18n | getCalendar(locale: string, type?: string): Calendar<sup>8+</sup> | Obtains the **Calendar** object for a specific locale and type. |
| ohos.i18n | setTime(date: Date): void<sup>8+</sup> | Sets the date for the **Calendar** object. |
| ohos.i18n | setTime(time: number): void<sup>8+</sup> | Sets the time for the **Calendar** object. |
| ohos.i18n | set(year: number, month: number, date: number, hour?: number, minute?: number, second?: number): void<sup>8+</sup> | Sets the year, month, day, hour, minute, and second for the **Calendar** object. |
| ohos.i18n | setTimeZone(timezone: string): void<sup>8+</sup> | Sets the time zone for the **Calendar** object. |
| ohos.i18n | getTimeZone(): string<sup>8+</sup> | Obtains the time zone for the **Calendar** object. |
| ohos.i18n | getFirstDayOfWeek(): number<sup>8+</sup> | Obtains the first day of a week for the **Calendar** object. |
| ohos.i18n | setFirstDayOfWeek(value: number): void<sup>8+</sup> | Sets the first day of a week for the **Calendar** object. |
| ohos.i18n | getMinimalDaysInFirstWeek(): number<sup>8+</sup> | Obtains the minimum count of days in the first week of a year. |
| ohos.i18n | setMinimalDaysInFirstWeek(value: number): void<sup>8+</sup> | Sets the minimum count of days in the first week of a year. |
| ohos.i18n | getDisplayName(locale: string): string<sup>8+</sup> | Obtains the localized display of the **Calendar** object. |
| ohos.i18n | isWeekend(date?: Date): boolean<sup>8+</sup> | Checks whether a given date is a weekend. |
### How to Develop
1. Instantiate a **Calendar** object.
Call the **getCalendar** method to obtain the time zone object of a specific locale and type (**i18n** is the name of the imported module). **type** indicates the valid calendar type, for example, **buddhist**, **chinese**, **coptic**, **ethiopic**, **hebrew**, **gregory**, **indian**, **islamic_civil**, **islamic_tbla**, **islamic_umalqura**, **japanese**, and **persian**. If **type** is left unspecified, the default calendar type of the locale is used.
```
var calendar = i18n.getCalendar("zh-CN", "gregory);
```
2. Set the time for the **Calendar** object.
Call the **setTime** method to set the time of the **Calendar** object. This method receives two types of parameters. One is a **Date** object, and the other is a value indicating the number of milliseconds elapsed since January 1, 1970, 00:00:00 GMT.
```
var date1 = new Date();
calendar.setTime(date1);
var date2 = 1000;
calendar.setTime(date2);
```
3. Set the year, month, day, hour, minute, and second for the **Calendar** object.
Call the **set** method to set the year, month, day, hour, minute, and second for the **Calendar** object.
```
calendar.set(2021, 12, 21, 6, 0, 0)
```
4. Set and obtain the time zone for the **Calendar** object.
Call the **setTimeZone** and **getTimeZone** methods to set and obtain the time zone for the **Calendar** object. The **setTimeZone** method requires an input string to indicate the time zone to be set.
```
calendar.setTimeZone("Asia/Shanghai");
var timezone = calendar.getTimeZone();
```
5. Set and obtain the first day of a week for the **Calendar** object.
Call the **setFirstDayOfWeek** and **getFirstDayOfWeek** methods to set and obtain the first day of a week for the **Calendar** object. **setFirstDayOfWeek** must be set to a value indicating the first day of a week. The value **1** indicates Sunday, and the value **7** indicates Saturday.
```
calendar.setFirstDayOfWeek(1);
var firstDayOfWeek = calendar.getFirstDayOfWeek();
```
6. Set and obtain the minimum count of days in the first week for the **Calendar** object.
Call the **setMinimalDaysInFirstWeek** and **getMinimalDaysInFirstWeek** methods to set and obtain the minimum count of days in the first week for the **Calendar** object.
```
calendar.setMinimalDaysInFirstWeek(3);
var minimalDaysInFirstWeek = calendar.getMinimalDaysInFirstWeek();
```
7. Obtain the localized display of the **Calendar** object.
Call the **getDisplayName** method to obtain the localized display of the **Calendar** object.
```
var localizedName = calendar.getDisplayName("zh-CN");
```
8. Check whether a date is a weekend.
Call the **isWeekend** method to determine whether the input date is a weekend.
```
var date = new Date();
var weekend = calendar.isWeekend(date);
```
## Formatting a Phone Number
[PhoneNumberFormat](../reference/apis/js-apis-intl.md) APIs are used to format phone numbers in different countries and check whether the phone number formats are correct.
### Available APIs
| Module | API | Description |
| -------- | -------- | -------- |
| ohos.i18n | constructor(country: string, options?: PhoneNumberFormatOptions)<sup>8+</sup> | Instantiates a **PhoneNumberFormat** object. |
| ohos.i18n | isValidNumber(number: string): boolean<sup>8+</sup> | Checks whether the value of **number** is a phone number in the correct format. |
| ohos.i18n | format(number: string): string<sup>8+</sup> | Formats the value of **number** based on the specified country and style. |
### How to Develop
1. Instantiate a **PhoneNumberFormat** object.
Call the **PhoneNumberFormat** constructor to instantiate a **PhoneNumberFormat** object. The country code and formatting options of the phone number need to be passed into this constructor. The formatting options are optional, including a style option. Values of this option include: **E164**, **INTERNATIONAL**, **NATIONAL**, and **RFC3966**.
```
var phoneNumberFormat = new i18n.PhoneNubmerFormat("CN", {type: "E164"});
```
2. Check whether the phone number format is correct.
Call the **isValidNumber** method to check whether the format of the input phone number is correct.
```
var validNumber = phoneNumberFormat.isValidNumber("15812341234");
```
3. Format a phone number.
Call the **format** method of **PhoneNumberFormat** to format the input phone number.
```
var formattedNumber = phoneNumberFormat.format("15812341234");
```
## Measurement Conversion
An API can be called to implement measurement conversion.
### Available APIs
| Module | API | Description |
| -------- | -------- | -------- |
| ohos.i18n | unitConvert(fromUnit: UnitInfo, toUnit: UnitInfo, value: number, locale: string, style?: string): string<sup>8+</sup> | Converts one measurement unit (**fromUnit**) into another (**toUnit**) and formats the unit based on the specified locale and style. |
### How to Develop
1. Convert a measurement unit.
Call the [unitConvert](../reference/apis/js-apis-intl.md) method to convert a measurement unit and format the display result.
```
var fromUnit = {unit: "cup", measureSystem: "US"};
var toUnit = {unit: "liter", measureSystem: "SI"};
var number = 1000;
var locale = "en-US";
var style = "long";
i18n.Util.unitConvert(fromUtil, toUtil, number, locale, style);
```
## Alphabet Index
[IndexUtil](../reference/apis/js-apis-intl.md) APIs are used to obtain the alphabet indexes of different locales and calculate the index to which a string belongs.
### Available APIs
| Module | API | Description |
| -------- | -------- | -------- |
| ohos.i18n | getInstance(locale?: string): IndexUtil<sup>8+</sup> | Instantiates an **IndexUtil** object. |
| ohos.i18n | getIndexList(): Array&lt;string&gt;<sup>8+</sup> | Obtains the index list of the current locale. |
| ohos.i18n | addLocale(locale: string): void<sup>8+</sup> | Adds the index of a new locale to the index list. |
| ohos.i18n | getIndex(text: string): string<sup>8+</sup> | Obtains the index of **text**. |
### How to Develop
1. Instantiate an **IndexUtil** object.
Call the **getInstance** method to instantiate an **IndexUtil** object for a specific locale. When the **locale** parameter is empty, instantiate an **IndexUtil** object of the default locale.
```
var indexUtil = getInstance("zh-CN");
```
2. Obtain the index list.
Call the **getIndexList** method to obtain the alphabet index list of the current locale.
```
var indexList = indexUtil.getIndexList();
```
3. Add an index.
Call the **addLocale** method to add the alphabet index of a new locale to the current index list.
```
indexUtil.addLocale("ar")
```
4. Obtain the index of a string.
Call the **getIndex** method to obtain the alphabet index of a string.
```
var text = "access index";
indexUtil.getIndex(text);
```
## Obtaining Line Breaks of Text
When a text is displayed in more than one line, [BreakIterator](../reference/apis/js-apis-intl.md) APIs are used to obtain the line break positions of the text.
### Available APIs
| Module | API | Description |
| -------- | -------- | -------- |
| ohos.i18n | getLineInstance(locale: string): BreakIterator<sup>8+</sup> | Instantiates a **BreakIterator** object. |
| ohos.i18n | setLineBreakText(text: string): void<sup>8+</sup> | Sets the text to be processed. |
| ohos.i18n | getLineBreakText(): string<sup>8+</sup> | Obtains the text to be processed. |
| ohos.i18n | current(): number<sup>8+</sup> | Obtains the current position of a **BreakIterator** object in the text being processed. |
| ohos.i18n | first(): number<sup>8+</sup> | Sets a **BreakIterator** object to the first breakable point. |
| ohos.i18n | last(): number<sup>8+</sup> | Sets a **BreakIterator** object to the last breakable point. |
| ohos.i18n | next(index?: number): number<sup>8+</sup> | Moves a **BreakIterator** object to the break point according to **index**. |
| ohos.i18n | previous(): number<sup>8+</sup> | Moves a **BreakIterator** object to the previous break point. |
| ohos.i18n | following(offset: number): number<sup>8+</sup> | Moves a **BreakIterator** object to the break point following the position specified by **offset**. |
| ohos.i18n | isBoundary(offset: number): boolean<sup>8+</sup> | Determines whether a position is a break point. |
### How to Develop
1. Instantiate a **BreakIterator** object.
Call the **getLineInstance** method to instantiate a **BreakIterator** object.
```
var locale = "en-US"
var breakIterator = i18n.getLineInstance(locale);
```
2. Set and access the text that requires line breaking.
Call the **setLineBreakText** and **getLineBreakText** methods to set and access the text that requires line breaking.
```
var text = "Apple is my favorite fruit";
breakIterator.setLineBreakText(text);
var breakText = breakIterator.getLineBreakText();
```
3. Obtain the current position of the **BreakIterator** object.
Call the **current** method to obtain the current position of the **BreakIterator** object in the text being processed.
```
var pos = breakIterator.current();
```
4. Set the position of a **BreakIterator** object.
The following APIs are provided to adjust the **first**, **last**, **next**, **previous**, or **following** position of the **BreakIterator** object in the text to be processed.
```
var firstPos = breakIterator.first(); // Sets a BreakIterator object to the first break point, that is, the start position of the text.
var lastPos = breakIterator.last(); // Sets a BreakIterator object to the last break point, that is, the position after the text end.
// Moves a BreakIterator object forward or backward by a certain number of break points.
// If a positive number is input, move backward. If a negative number is input, move forward. If no value is input, move one position backward.
// When the object is moved out of the text length range, -1 is returned.
var nextPos = breakIterator.next(-2);
var previousPos = breakIterator.previous(); // Moves a BreakIterator object to the previous break point. When the text length is out of the range, -1 is returned.
// Moves a BreakIterator object to the break point following the position specified by offset. If the object is moved out of the text length range, -1 is returned.
var followingPos = breakIterator.following(10);
```
5. Determine whether a position is a break point.
Call the **isBoundary** method to determine whether a position is a break point. If yes, **true** is returned and the **BreakIterator** object is moved to this position. If no, **false** is returned and the **BreakIterator** object is moved to a break point after this position.
```
var isboundary = breakIterator.isBoundary(5);
```
# Overview
If an application is targeted for users and markets in different regions with different languages and time zones, it is necessary for you to provide localized versions to ensure good experience for your users.
Internationalization capabilities determine how hard or easy application localization will be. With the rich internationalization APIs provided by the system, localization is much more efficient and cost-effective, accelerating your design and implementation of a well-internationalized application.
## Basic Concepts
- Locale: an abstract representation of the commonalities of a group in terms of language, script, country or region, and other regional features such as calendar, sorting, and currency.
- Preferred language: the language that the user prefers to use in a service or system. You can add a preferred language by choosing **Settings** &gt; **System &amp; updates** &gt; **Language &amp; input** &gt; **Language and region** &gt; **ADD LANGUAGE** on your mobile phone.
## Working Principles
You just need to specify a locale when calling internationalization APIs, and localization will be automatically implemented for that locale. Locale information can be hard coded, but it is more common for users to set the system language and region by themselves.
## Constraints
None
# Internationalization Development (intl)
## Setting Locale Information
[Locale](../reference/apis/js-apis-intl.md) APIs are used to maximize or minimize locale information.
### Available APIs
| Module | API | Description |
| -------- | -------- | -------- |
| ohos.intl | constructor()<sup>8+</sup> | Instantiates a **Locale** object. |
| ohos.intl | constructor(locale?: string, options?: options) | Instantiates a **Locale** object based on the locale parameter and options. |
| ohos.intl | toString(): string | Converts locale information into a string. |
| ohos.intl | maximize(): Locale | Maximizes locale information. |
| ohos.intl | minimize(): Locale | Minimizes locale information. |
### How to Develop
1. Instantiate a **Locale** object.
Create a **Locale** object using the **Locale** constructor. This method receives a string representing the locale and an optional [Attributes](../reference/apis/js-apis-intl.md) list (**intl** is the name of the imported module).
```
var locale = "zh-CN";
var options = {caseFirst: false, calendar: "chinese", collation: pinyin};
var localeObj = new intl.Locale(locale, options);
```
2. Obtain the string representing a **Locale** object.
Call the **toString** method to obtain the string representing a **Locale** object, including the language, region, and other options.
```
var localeStr = localeObj.toString();
```
3. Maximize locale information.
Call the **maximize** method to maximize locale information; that is, supplement the missing script and region information.
```
var maximizedLocale = localeObj.maximize();
```
4. Minimize locale information.
Call the **minimize** method to minimize locale information; that is, delete the unnecessary script and region information.
```
var minimizedLocale = localeObj.minimize();
```
## Formatting the Date and Time
[DateTimeFormat](../reference/apis/js-apis-intl.md) APIs are used to format the date and time for a specific locale.
### Available APIs
| Module | API | Description |
| -------- | -------- | -------- |
| ohos.intl | constructor()<sup>8+</sup> | Creates a **DateTimeFormat** object. |
| ohos.intl | constructor(locale: string \| Array&lt;string&gt;, options?: DateTimeOptions) | Creates a **DateTimeFormat** object and sets the locale and other formatting-related attributes. |
| ohos.intl | format(date: Date): string | Calculates the date and time based on the locale and other formatting-related attributes of the **DateTimeFormat** object. |
| ohos.intl | formatRange(startDate: Date, endDate: Date): string | Calculates the period based on the locale and other formatting-related attributes of the **DateTimeFormat** object. |
| ohos.intl | resolvedOptions(): DateTimeOptions | Obtains the related attributes of the **DateTimeFormat** object. |
### How to Develop
1. Instantiate a **DateTimeFormat** object.
Use the default constructor of **DateTimeFormat** to obtain the system default locale by accessing the system language and region settings, and set it as the locale in the **DateTimeFormat** object (**intl** is the name of the imported module).
```
var dateTimeFormat = new intl.DateTimeFormat();
```
Alternatively, use your own locale and formatting parameters to create a **DateTimeFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [DateTimeOptions](../reference/apis/js-apis-intl.md).
```
var options = {dateStyle: "full", timeStyle: "full"};
var dateTimeFormat = new intl.DateTimeFormat("zh-CN", options);
```
2. Format the date and time.
Use the **format** method of **DateTimeFormat** to format a **Date** object. A string is returned as the formatting result.
```
Date date = new Date();
var formatResult = dateTimeFormat.format(date);
```
3. Format a period.
Use the **formatRange** method of **DateTimeFormat** to format a period. This method requires the input of two **Date** objects, which respectively indicate the start date and end date of a period. A string is returned as the formatting result.
```
Date startDate = new Date();
Date endDate = new Date();
var formatResult = dateTimeFormat.formatRange(startDate, endDate);
```
4. Access the attributes of the **DateTimeFormat** object.
The **resolvedOptions** method of **DateTimeFormat** returns an object that contains all related attributes and values of the **DateTimeFormat** object.
```
var options = dateTimeFormat.resolvedOptions();
```
## Number Formatting
[NumberFormat](../reference/apis/js-apis-intl.md) APIs are used to format a number for a specific locale.
### Available APIs
| Module | API | Description |
| -------- | -------- | -------- |
| ohos.intl | constructor()<sup>8+</sup> | Creates a **NumberFormat** object. |
| ohos.intl | constructor(locale: string \| Array&lt;string&gt;, options?: NumberOptions) | Creates a **NumberFormat** object and sets the locale and other formatting-related attributes. |
| ohos.intl | format(number: number): string | Calculates the number based on the locale and other formatting-related attributes of the **NumberFormat** object. |
| ohos.intl | resolvedOptions(): NumberOptions | Obtains the attributes of the **NumberFormat** object. |
### How to Develop
1. Instantiate a **NumberFormat** object.
Use the default constructor of **NumberFormat** to obtain the system default locale by accessing the system language and region settings and set it as the locale in the **NumberFormat** object (**intl** is the name of the imported module).
```
var numberFormat = new intl.NumberFormat();
```
Alternatively, use your own locale and formatting parameters to create a **NumberFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [NumberOptions](../reference/apis/js-apis-intl.md).
```
var options = {compactDisplay: "short", notation: "compact"};
var numberFormat = new intl.NumberFormat("zh-CN", options);
```
2. Format a number.
Use the **format** method of **NumberFormat** to format a number. A string is returned as the formatting result.
```
var number = 1234.5678
var formatResult = numberFormat.format(number);
```
3. Access the attributes of the **NumberFormat** object.
The **resolvedOptions** method of NumberFormat returns an object that contains all related attributes and values of the **NumberFormat** object.
```
var options = numberFormat.resolvedOptions();
```
## String Sorting
Users in different regions have different requirements for string sorting. [Collator](../reference/apis/js-apis-intl.md) APIs are used to sort strings based on a specific locale.
### Available APIs
| Module | API | Description |
| -------- | -------- | -------- |
| ohos.intl | constructor()<sup>8+</sup> | Creates a **Collator** object. |
| ohos.intl | constructor(locale: string \| Array&lt;string&gt;, options?: CollatorOptions)<sup>8+</sup> | Creates a **Collator** object and sets the locale and other related attributes. |
| ohos.intl | compare(first: string, second: string): number<sup>8+</sup> | Calculates the comparison result of two strings based on the locale and other attributes of the **Collator** object. |
| ohos.intl | resolvedOptions(): CollatorOptions<sup>8+</sup> | Obtains the attributes of the **Collator** object. |
### How to Develop
1. Instantiate a **Collator** object.
Use the default constructor of **Collator** to obtain the system default locale by accessing the system language and region settings and set it as the locale in the **Collator** object (**intl** is the name of the imported module).
```
var collator = new intl.Collator();
```
Alternatively, use your own locale and formatting parameters to create a **Collator** object. For a full list of parameters, see [CollatorOptions](../reference/apis/js-apis-intl.md).
```
var collator= new intl.Collator("zh-CN", {localeMatcher: "best fit", usage: "sort"};
```
2. Compare two strings.
Use the **compare** method of **Collator** to compare two input strings. This method returns a value as the comparison result. The return value **-1** indicates that the first string is shorter than the second string, the return value **1** indicates that the first string is longer than the second string, and the return value **0** indicates that the two strings are of equal lengths.
```
var str1 = "first string";
var str2 = "second string";
var compareResult = collator.compare(str1, str2);
```
3. Access the attributes of the **Collator** object.
The **resolvedOptions** method of **Collator** returns an object that contains all related attributes and values of the **Collator** object.
```
var options = collator.resolvedOptions();
```
## Determining the Singular-Plural Type
According to grammars in certain languages, the singular or plural form of a noun depends on the number prior to the noun. [PluralRules](../reference/apis/js-apis-intl.md) APIs are used to determine the singular-plural type for a specific locale.
### Available APIs
| Module | API | Description |
| -------- | -------- | -------- |
| ohos.intl | constructor()<sup>8+</sup> | Creates a **PluralRules** object. |
| ohos.intl | constructor(locale: string \| Array&lt;string&gt;, options?: PluralRulesOptions)<sup>8+</sup> | Creates a **PluralRules** object and sets the locale and other related attributes. |
| ohos.intl | select(n: number): string<sup>8+</sup> | Determines the singular-plural type based on the locale and other formatting-related attributes of the **PluralRules** object. |
### How to Develop
1. Instantiate a **PluralRules** object.
Use the default constructor of **PluralRules** to obtain the system default locale by accessing the system language and region settings and set it as the locale in the **PluralRules** object (**intl** is the name of the imported module).
```
var pluralRules = new intl.PluralRules();
```
Alternatively, use your own locale and formatting parameters to create a **PluralRules** object. For a full list of parameters, see [PluralRulesOptions](../reference/apis/js-apis-intl.md).
```
var plurals = new intl.PluralRules("zh-CN", {localeMatcher: "best fit", type: "cardinal"};
```
2. Determine the singular or plural category.
Use the **select** method of **PluralRules** to determine the singular-plural type for an input number. This method returns a string as the category of the input number, which can be any of the following: **zero**, **one**, **two**, **few**, **many**, and **other**.
```
var number = 1234.5678
var categoryResult = plurals.select(number);
```
## Formatting Relative Time
[RelativeTimeFormat](../reference/apis/js-apis-intl.md) APIs are used to format the relative time for a specific locale.
### Available APIs
| Module | API | Description |
| -------- | -------- | -------- |
| ohos.intl | constructor()<sup>8+</sup> | Creates a **RelativeTimeFormat** object. |
| ohos.intl | constructor(locale: string \| Array&lt;string&gt;, options?: RelativeTimeFormatInputOptions)<sup>8+</sup> | Creates a **RelativeTimeFormat** object and sets the locale and other formatting-related attributes. |
| ohos.intl | format(value: number, unit: string): string<sup>8+</sup> | Calculates the relative time format based on the locale and other formatting-related attributes of the **RelativeTimeFormat** object. |
| ohos.intl | formatToParts(value: number, unit: string): Array&lt;object&gt;<sup>8+</sup> | Returns each part of the relative time format based on the locale and other formatting-related attributes of the **RelativeTimeFormat** object. |
| ohos.intl | resolvedOptions(): RelativeTimeFormatResolvedOptions<sup>8+</sup> | Obtains the attributes of the **RelativeTimeFormat** object. |
### How to Develop
1. Instantiate a **RelativeTimeFormat** object.
Use the default constructor of **RelativeTimeFormat** to obtain the system default locale by accessing the system language and region settings and set it as the locale in the **RelativeTimeFormat** object (**intl** is the name of the imported module).
```
var relativeTimeFormat = new intl.RelativeTimeFormat();
```
Alternatively, use your own locale and formatting parameters to create a **RelativeTimeFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [ RelativeTimeFormatInputOptions](../reference/apis/js-apis-intl.md).
```
var relativeTimeFormat = new intl.RelativeTimeFormat("zh-CN", {numeric: "always", style: "long"};
```
2. Format the relative time.
Use the **format** method of **RelativeTimeFormat** to format the relative time. This method receives a numeric value representing the time length and a string-form unit, like **year**, **quarter**, **month**, **week**, **day**, **hour**, **minute**, and **second**. A string is returned as the formatting result.
```
var number = 2;
var unit = "year"
var formatResult = relativeTimeFormat.format(number, unit);
```
3. Obtain each part of the relative time format.
On obtaining each part of the relative time format, customize the relative time formatting result.
```
var number = 2;
var unit = "year"
var formatResult = relativeTimeFormat.formatToParts(number, unit);
```
4. Access the attributes of the **RelativeTimeFormat** object.
The **resolvedOptions** method of **RelativeTimeFormat** returns an object that contains all related attributes and values of the **RelativeTimeFormat** object. For a full list of attributes, see [ RelativeTimeFormatResolvedOptions](../reference/apis/js-apis-intl.md).
```
var options = numberFormat.resolvedOptions();
```
# Basics # Quick Start
- [DevEco Studio \(OpenHarmony\) User Guide](deveco-studio-user-guide-for-openharmony.md) - Getting Started
- [Overview](deveco-studio-overview.md) - [Preparations](start-overview.md)
- [Version Change History](deveco-studio-release-notes.md) - [Getting Started with eTS](start-with-ets.md)
- [Configuring the OpenHarmony SDK](configuring-openharmony-sdk.md) - [Getting Started with JavaScript in the Traditional Coding Approach](start-with-js.md)
- [Creating an OpenHarmony Project](create-openharmony-project.md) - [Getting Started with JavaScript in the Low-Code Approach](start-with-js-low-code.md)
- [Using the Project Wizard to Create a Project](use-wizard-to-create-project.md)
- [Importing a Sample to Create a Project](import-sample-to-create-project.md) - Development Fundamentals
- [Directory Structure](package-structure.md)
- [Configuring the OpenHarmony App Signature](configuring-openharmony-app-signature.md) - [Resource File](basic-resource-file-categories.md)
- [Installing and Running Your OpenHarmony App](installing-openharmony-app.md)
- [Directory Structure](package-structure.md)
# Configuring the OpenHarmony App Signature<a name="EN-US_TOPIC_0000001159890371"></a>
- [Generating a Key Store and CSR](#section153146467405)
- [In DevEco Studio](#section1298903211472)
- [In a Command-Line Tool](#section1276462024811)
- [Generating an App Certificate](#section136609429562)
- [Generating the App Profile](#section2048641015325)
- [Configuring App Signature Information](#section10152423193310)
Before running and debugging the OpenHarmony app on a real device, you need to sign the app. This section describes how to configure the signature of an OpenHarmony app. Operation instructions are the same in _HUAWEI DevEco Studio User Guide_ except this section. For details, see [HUAWEI DevEco Studio User Guide](https://developer.harmonyos.com/en/docs/documentation/doc-guides/tools_overview-0000001053582387). See the following figure for the process of configuring app signature information.
![](figures/en-us_image_0000001113808114.png)
## Generating a Key Store and CSR<a name="section153146467405"></a>
OpenHarmony uses digital certificates \(.cer\) and **Profile** files \(.p7b\) to ensure app integrity. Before applying for these files, you need to generate a key store \(.p12\) and a certificate signing request \(.csr\). You can do so in DevEco Studio or a command-line tool.
### In DevEco Studio<a name="section1298903211472"></a>
1. On the menu bar, choose **Build** \> **Generate Key and CSR**.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>If you have a local key, click **Skip** in the **Generate Key** window and use the key to generate a CSR file.
2. In **Key Store File**, click **Choose Existing** to select an existing key store \(.p12 file that contains a key\) or **New** to create one. The following describes how to create a key store.
![](figures/en-us_image_0000001119560738.png)
3. In the **Create Key Store** dialog box, set the following parameters and click **OK**.
- **Key Store File**: Select the path for storing the key store.
- **Password**: Set the key store password, which must contain at least 8 characters that include two types of the following: uppercase letters, lowercase letters, digits, and special characters. Do not lose the password as it will be used later in configuring the signature.
- **Confirm Password**: Enter the key store password again.
![](figures/en-us_image_0000001152674854.png)
4. In the **Generate Key** window, set the following parameters and click **Next**.
- **Alias**: Enter the alias of the key, which is used to identify the key name. Do not lose the alias as it will be used later in configuring the signature.
- **Password**: password of the key, which is automatically filled in and the same as the keystore password.
- **Validity**: Specify the certificate validity period. A validity period of 25 years or longer is recommended to cover the entire lifecycle of your app/service.
- **Certificate**: Enter basic certificate information.
![](figures/en-us_image_0000001117639668.png)
5. In the **Generate CSR** window, select the key and set the storage path of the CSR file.
![](figures/en-us_image_0000001117479776.png)
6. Click **OK**. You can then obtain the generated keystore file \(.p12\) and CSR file \(.csr\) from the storage path.
![](figures/en-us_image_0000001163839541.png)
### In a Command-Line Tool<a name="section1276462024811"></a>
Use the Keytool in the Open JDK to generate a CSR.
1. Run the Keytool as an administrator.
![](figures/en-us_image_0000001248045243.png)
2. Switch to the directory where the Keytool is located.
![](figures/en-us_image_0000001247125297.png)
3. Run the following command to generate a key store. This example creates a key store named **ide\_demo\_app.p12** and saves it to the root directory of the D drive.
```
keytool -genkeypair -alias "ide_demo_app" -keyalg EC -sigalg SHA256withECDSA -dname "C=CN,O=Organization,OU=Unit,CN=ide_demo_app" -keystore d:\\idedemokey.p12 -storetype pkcs12 -validity 9125 -storepass 123456Abc -keypass 123456Abc
```
Parameters in the key store:
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>Record the values of **alias**, **storepass**, and **keypass**, which will be used in [Configuring App Signature Information](#section10152423193310).
- **alias**: alias of the key, which is used to identify the key name.
- **sigalg**: signature algorithm, which is automatically set to **SHA256withECDSA** and cannot be changed.
- **dname**:
- **C**: country/region code, such as **CN**.
- **O**: organization name, such as **Organization**.
- **OU**: organization unit name, such as **Unit**.
- **CN**: your first name and last name. Set this parameter to be the same as **alias**.
- **validity**: certificate validity period. It is recommended that you set this parameter to **9125** \(25 years\).
- **storepass**: key store password, which must contain at least 8 characters that include two types of the following: uppercase letters, lowercase letters, digits, and special characters. Do not lose the password as it will be used later in configuring the signature.
- **keypass**: password of the key. The value must be the same as that of **storepass**.
4. Run the following command. After the command is executed, enter the **storepass** to generate a CSR in .csr format.
```
keytool -certreq -alias "ide_demo_app" -keystore d:\\idedemokey.p12 -storetype pkcs12 -file d:\\idedemokey.csr
```
Parameters in the CSR:
- **alias**: The value must be the same as the alias set in 3.
- **file**: name of the generated CSR. The file name extension is .csr.
## Generating an App Certificate<a name="section136609429562"></a>
Use the CSR generated in [Generating a Key Store and CSR](#section153146467405) to generate the digital certificate required for app signing. The method is as follows:
Go to the **Sdk\\toolchains\\lib** directory where the OpenHarmony SDK is saved \(see [Configuring the OpenHarmony SDK](configuring-openharmony-sdk.md) for details\) in the DevEco Studio installation directory, and run the following command in the CLI. If the **keytool** command cannot be executed, add the JDK environment variables to the system environment variables. You only need to modify the input and output to quickly generate a certificate. That is, modify **-infile** to specify the path of the CSR and **-outfile** to specify the name and path of the output certificate.
```
keytool -gencert -alias "OpenHarmony Application CA" -infile myApplication_ohos.csr -outfile myApplication_ohos.cer -keystore OpenHarmony.p12 -sigalg SHA384withECDSA -storepass 123456 -ext KeyUsage:"critical=digitalSignature" -validity 3650 -rfc
```
Refer to the following descriptions about the parameters in the command:
- **alias**: alias of the CA private key used for issuing certificates. The CA private key of the OpenHarmony community is stored in the **OpenHarmony.p12** key store file. This parameter cannot be modified.
- **infile**: path of the CSR file.
- **outfile**: name and path of the certificate chain file.
- **keystore**: path of the CA key store for issuing certificates. The name of the OpenHarmony key store file is **OpenHarmony.p12**. The file is stored in **Sdk\\toolchains\\lib** of the OpenHarmony SDK. This parameter cannot be modified. Note that the **OpenHarmony.p12** file is not the .p12 file generated in [Generating a Key Store and CSR](#section153146467405).
- **sigalg**: certificate signature algorithm. This parameter cannot be modified.
- **storepass**: key store password. The password is **123456** and cannot be changed.
- **ext**: certificate extension. This parameter cannot be modified.
- **validity**: certificate validity period, which is user-defined.
- **rfc**: specifies the output file format. This parameter cannot be modified.
## Generating the App Profile<a name="section2048641015325"></a>
The profile contains the following information about the OpenHarmony app: bundle name, digital certificate information, certificate permissions that can be applied for by the app, and devices where the app can be debugged \(the device list will be empty if the app type is Release\). Each app package must contain a profile file.
Go to the **Sdk\\toolchains\\lib** directory, open the command-line tool, and run the following command.
```
java -jar provisionsigtool.jar sign --in UnsgnedReleasedProfileTemplate.json --out myApplication_ohos_Provision.p7b --keystore OpenHarmony.p12 --storepass 123456 --alias "OpenHarmony Application Profile Release" --sigAlg SHA256withECDSA --cert OpenHarmonyProfileRelease.pem --validity 365 --developer-id ohosdeveloper --bundle-name app bundle name --permission restricted permission name (optional) --permission restricted permission name (optional) --distribution-certificate myApplication_ohos.cer
```
Refer to the following descriptions about the parameters in the command:
- **provisionsigtool**: tool for generating the profile which is stored in **Sdk\\toolchains\\lib** of the OpenHarmony SDK.
- **in**: path of the profile template which is stored in **Sdk\\toolchains\\lib** of the OpenHarmony SDK. This parameter cannot be modified.
- **out**: name and path of the profile.
- **keystore**: path of the key store for issuing certificates. The name of the OpenHarmony key store file is **OpenHarmony.p12**. The file is stored in **Sdk\\toolchains\\lib** of the OpenHarmony SDK. This parameter cannot be modified.
- **storepass**: key store password. The password is **123456** and cannot be changed.
- **alias**: alias of the private key used for app signing. The CA private key of the OpenHarmony community is stored in the **OpenHarmony.p12** key store file. This parameter cannot be modified.
- **sigalg**: certificate signature algorithm. This parameter cannot be modified.
- **cert**: path of the certificate of the signature profile. The file is stored in **Sdk\\toolchains\\lib** of the OpenHarmony SDK. This parameter cannot be modified.
- **validity**: certificate validity period, which is user-defined.
- **developer-id**: developer ID, which is a user-defined character string.
- **bundle-name**: app bundle name.
- **permission** \(optional\): If permissions are not required, this field can be left empty. You can add multiple restricted permissions in the following way: ohos.permission.READ\_CONTACTS, ohos.permission.WRITE\_CONTACTS.
- **distribution-certificate**: certificate generated in [Generating an App Certificate](#section136609429562).
## Configuring App Signature Information<a name="section10152423193310"></a>
Before debugging on a real device, use the private key file \(.p12\), certificate file \(.cer\), and profile file \(.p7b\) to sign the target module.
Go to **File** \> **Project Structure** \> **Project** \> **Signing Configs** \> **debug**, deselect **Automatically generate signing**, and configure the signature information of the specified module.
- **Store File**: Select the key store file with the file name extension .p12, which is generated in [Generating a Key Store and CSR](#section153146467405).
- **Store Password**: Enter the key store password, which is the same as the key store password entered in [Generating a Key Store and CSR](#section153146467405).
- **Key Alias**: Enter the alias of the key, which is the same as the alias entered in [Generating a Key Store and CSR](#section153146467405).
- **Key Password**: Enter the key password, which is the same as the value of **Store Password**.
- **Sign Alg**: Specify the signature algorithm, which has a fixed value of **SHA256withECDSA**.
- **Profile File**: Select the .p7b profile file generated in [Generating the App Profile](#section2048641015325).
- **Certpath File**: Select the .cer debug certificate generated in [Generating an App Certificate](#section136609429562).
![](figures/en-us_image_0000001155643492.png)
Click **OK** to save your configurations. Then you can view the signature configuration information in **build.gradle** of the project.
![](figures/en-us_image_0000001202722349.png)
By default, the type of a HAP package compiled using DevEco Studio is set to **debug**. For a release type, click the **OhosBuild Variants** tab in the lower left corner of the project and set the type to **release**. For details about how to compile and build the HAP, see [HUAWEI DevEco Studio User Guide](https://developer.harmonyos.com/en/docs/documentation/doc-guides/build_hap-0000001053342418).
![](figures/en-us_image_0000001115066116.png)
After the compilation is complete, you can obtain the HAP package of your OpenHarmony app from the **build** directory of the project.
![](figures/en-us_image_0000001163918627.png)
# Configuring the OpenHarmony SDK<a name="EN-US_TOPIC_0000001113561194"></a>
- [Prerequisites](#section164161442154812)
- [Configuring the SDK Information](#section1265592425017)
- [References](#section0384143616409)
- [Setting Up the DevEco Studio Proxy](#section10129720184214)
- [Setting Up the npm Proxy](#section19984059114316)
- [Setting Up the Gradle Proxy](#section164211820465)
To set up the OpenHarmony app development environment, configure the corresponding SDK information in DevEco Studio first.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>The OpenHarmony SDK is not applicable to HarmonyOS app development, with some necessary toolchains removed.
## Prerequisites<a name="section164161442154812"></a>
[DevEco Studio 3.0 Beta1](https://developer.harmonyos.com/cn/develop/deveco-studio#download) or later has been downloaded and installed.
## Configuring the SDK Information<a name="section1265592425017"></a>
DevEco Studio manages SDKs and toolchains using SDK Manager. OpenHarmony contains the following SDK packages:
<a name="table64565810577"></a>
<table><thead align="left"><tr id="row12455580576"><th class="cellrowborder" valign="top" width="24.709999999999997%" id="mcps1.1.4.1.1"><p id="p34565812572"><a name="p34565812572"></a><a name="p34565812572"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="25.3%" id="mcps1.1.4.1.2"><p id="p104675817575"><a name="p104675817575"></a><a name="p104675817575"></a>Package Name</p>
</th>
<th class="cellrowborder" valign="top" width="49.99%" id="mcps1.1.4.1.3"><p id="p194610586574"><a name="p194610586574"></a><a name="p194610586574"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row44334409916"><td class="cellrowborder" rowspan="2" valign="top" width="24.709999999999997%" headers="mcps1.1.4.1.1 "><p id="p88381448125813"><a name="p88381448125813"></a><a name="p88381448125813"></a>SDK</p>
</td>
<td class="cellrowborder" valign="top" width="25.3%" headers="mcps1.1.4.1.2 "><p id="p1946175813574"><a name="p1946175813574"></a><a name="p1946175813574"></a>JS</p>
</td>
<td class="cellrowborder" valign="top" width="49.99%" headers="mcps1.1.4.1.3 "><p id="p54625885713"><a name="p54625885713"></a><a name="p54625885713"></a>SDK for JS.</p>
</td>
</tr>
<tr id="row12199716103617"><td class="cellrowborder" valign="top" headers="mcps1.1.4.1.1 "><p id="p9200131683616"><a name="p9200131683616"></a><a name="p9200131683616"></a>eTS</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.4.1.2 "><p id="p523912359172"><a name="p523912359172"></a><a name="p523912359172"></a>SDK for Extended TypeScript (eTS).</p>
</td>
</tr>
<tr id="row14474585576"><td class="cellrowborder" rowspan="2" valign="top" width="24.709999999999997%" headers="mcps1.1.4.1.1 "><p id="p124765819578"><a name="p124765819578"></a><a name="p124765819578"></a>SDK Tool</p>
</td>
<td class="cellrowborder" valign="top" width="25.3%" headers="mcps1.1.4.1.2 "><p id="p1947135818571"><a name="p1947135818571"></a><a name="p1947135818571"></a>Toolchains</p>
</td>
<td class="cellrowborder" valign="top" width="49.99%" headers="mcps1.1.4.1.3 "><p id="p7471158105711"><a name="p7471158105711"></a><a name="p7471158105711"></a>Includes compiling, packaging, signing, database management, and other tools that are required to develop OpenHarmony apps.</p>
</td>
</tr>
<tr id="row337931010"><td class="cellrowborder" valign="top" headers="mcps1.1.4.1.1 "><p id="p193791108"><a name="p193791108"></a><a name="p193791108"></a>Previewer</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.4.1.2 "><p id="p1238951018"><a name="p1238951018"></a><a name="p1238951018"></a>OpenHarmony app previewer, which can be used to view the UI layout during app development.</p>
</td>
</tr>
</tbody>
</table>
1. Open DevEco Studio. If this is the first time you are using it, select **Do not import settings** and click **OK**.
2. Follow the wizard to set **npm registry**. DevEco Studio has been preconfigured with the corresponding registry. Click **Start using DevEco Studio** to go to the next step.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>If the **Set up HTTP Proxy** page is displayed, it indicates that your network requires a proxy. In this case, set up the DevEco Studio proxy, npm proxy, and Gradle proxy according to [References](#section0384143616409), and then download the OpenHarmony SDK.
![](figures/en-us_image_0000001163314102.png)
3. Follow the wizard to download the SDK. By default, the OpenHarmony SDK will be downloaded. You can download the SDK to the default **user** directory or a local path that does not contain any Chinese characters. Then click **Next**.
![](figures/en-us_image_0000001208394019.png)
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>If you are not using DevEco Studio for the first time, the SDK download page may not be displayed. In this case, go to **Configure** \(or ![](figures/en-us_image_0000001208274069.png)\) \> **Settings** \> **SDK Manager** \> **OpenHarmony SDK** and click **OpenHarmony SDK Location** to download the SDK.
4. On the **Settings Confirmation** page, click **Next**. When the **License Agreement** dialog box appears, click **Accept**.
![](figures/en-us_image_0000001163472654.png)
5. After the OpenHarmony SDK and tools are downloaded, click **Finish** to access the DevEco Studio welcome page.
![](figures/en-us_image_0000001163632602.png)
## References<a name="section0384143616409"></a>
Setting up the development environment requires that your network can directly access the Internet.
Generally, only some enterprise networks rather than personal area networks or home networks require a proxy to access the Internet.
If you are using DevEco Studio for the first time and the **Set up HTTP Proxy** page is displayed, it indicates that your network requires a proxy. In this case, set up the DevEco Studio proxy, npm proxy, and Gradle proxy.
![](figures/en-us_image_0000001166582138.png)
### Setting Up the DevEco Studio Proxy<a name="section10129720184214"></a>
1. Start DevEco Studio. On the **Set up HTTP Proxy** page that is displayed, select **Manual proxy configuration** and set the HTTP proxy.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>If this is not the first time you are using DevEco Studio:
>- On the welcome page, choose **Configure** \(or ![](figures/en-us_image_0000001212142015.png)\)** \> Settings \> Appearance & Behavior \> System Settings \> HTTP Proxy** to access the HTTP Proxy settings. \(For macOS, choose **Configure \> Preferences \> Appearance & Behavior \> System Settings \> HTTP Proxy**.\)
>- When on a project page, choose **File \> Settings \> Appearance & Behavior \> System Settings \> HTTP Proxy** to access the HTTP Proxy settings. \(For macOS, choose **DevEco Studio \> Preferences \> Appearance & Behavior \> System Settings \> HTTP Proxy**.\)
- **HTTP** parameters: **If you are not sure about the information, contact your network administrator.**
- **Host name**: Enter the host name or IP address of the proxy server.
- **Port number**: Enter the port number of the proxy server.
- **No proxy for**: Enter the URLs or IP addresses which the PC can directly connect to without a proxy server. Use commas \(,\) to separate URLs and IP addresses.
- **Proxy authentication** parameters: Set the parameters only when the proxy server requires authentication.
- **Login**: Enter the user name used to access the proxy server.
- **Password**: Enter the password used to access the proxy server.
- **Remember**: Select this option to remember the password.
![](figures/en-us_image_0000001212062065.png)
2. When you have finished, click **Check connection** and enter a URL to check the network connectivity. If the message "Connection successful" is displayed, it indicates that the proxy was set up successfully.
3. Click **Next: Configure npm** to set up the npm proxy. For details, see [Setting Up the npm Proxy](#section19984059114316).
### Setting Up the npm Proxy<a name="section19984059114316"></a>
Follow the configuration wizard of DevEco Studio to configure the npm proxy information, which will be written into the **.npmrc** file in the **users/**_user name_ directory.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>The configuration wizard is displayed only the first time you install DevEco Studio. If the wizard is not displayed, manually add the proxy information to the **.npmrc** file in the **users/**_user name_ directory.
- **npm registry**: Set the address of the npm registry. You are advised to select this option.
- **HTTP proxy**: Proxy server information. By default, the value is the same as that of **HTTP proxy** of DevEco Studio.
- **Enable Https Proxy**: Indicates whether to configure HTTPS proxy. You are advised to select this option.
![](figures/en-us_image_0000001164577336.png)
Click **Start using DevEco Studio**.
If your proxy server requires the user name and password for authentication, set the user name and password as follows. If your proxy server does not require authentication, skip this step and follow the instructions in [Configuring the SDK Information](#section1265592425017).
![](figures/en-us_image_0000001209817299.png)
1. Go to the **Users** directory and open the **.npmrc** file.
2. Modify the npm proxy information. Add the **user** and **password** fields to **proxy** and **https-proxy**. Note that the values may vary depending on the proxy. The following is an example:
```
proxy=http://user:password@proxy.server.com:80
https-proxy=http://user:password@proxy.server.com:80
```
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>If the password contains special characters, such as @, \#, and \*, the configuration may not take effect. You are advised to replace the special characters with ASCII codes and add "%" before the ASCII codes. Refer to the following for the mapping between common symbols and ASCII codes.
>- !: %21
>- @: %40
>- \#: %23
>- ¥: %24
>- &: %26
>- \*: %2A
3. After the proxy is configured, open the CLI and run the following command to check whether the network is normal.
```
npm info express
```
If the following information is displayed after running the command, it indicates that the proxy has been set up successfully.
![](figures/en-us_image_0000001164417356.png)
4. When you are done, follow the instructions in [Configuring the SDK Information](#section1265592425017).
### Setting Up the Gradle Proxy<a name="section164211820465"></a>
1. Open **This PC**, and enter **%userprofile%** in the address box to access the user profile. \(For macOS, choose **Go** \> **Home**.\)
![](figures/en-us_image_0000001166740700.png)
2. Create a **.gradle** folder if there is none.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>Before creating a **.gradle** folder in macOS, set the system to show hidden files.
3. Open the **.gradle** folder, create a **gradle** file, and change the file name extension to .properties.
4. Add the following script to the **gradle.properties** file and save the file:
Modify the host name, port number, user name, password, and proxy exceptions \(**nonProxyHosts**\) based on the actual condition. Separate values for **nonProxyHosts** with a vertical bar \(|\).
```
systemProp.http.proxyHost=proxy.server.com
systemProp.http.proxyPort=8080
systemProp.http.nonProxyHosts=*.company.com|10.*|100.*
systemProp.http.proxyUser=userId
systemProp.http.proxyPassword=password
systemProp.https.proxyHost=proxy.server.com
systemProp.https.proxyPort=8080
systemProp.https.nonProxyHosts=*.company.com|10.*|100.*
systemProp.https.proxyUser=userId
systemProp.https.proxyPassword=password
```
# Creating an OpenHarmony Project<a name="EN-US_TOPIC_0000001130929834"></a>
- **[Using the Project Wizard to Create a Project](use-wizard-to-create-project.md)**
- **[Importing a Sample to Create a Project](import-sample-to-create-project.md)**
# Overview<a name="EN-US_TOPIC_0000001116414108"></a>
- [About the Document](#section189422248491)
- [Restrictions](#section65191625782)
- [DevEco Studio Evolution Roadmap](#section187875207166)
## About the Document<a name="section189422248491"></a>
DevEco Studio is an integrated development environment \(IDE\) of HarmonyOS apps. As HarmonyOS is developed based on OpenHarmony, DevEco Studio can also be used to develop OpenHarmony apps.
The process of developing an OpenHarmony app using DevEco Studio is the same as that of developing a HarmonyOS app. This document describes the differences between OpenHarmony and HarmonyOS app development.
- **Environment setup**: You need to manually install the OpenHarmony SDK for the OpenHarmony app development. For details, see [Configuring the OpenHarmony SDK](configuring-openharmony-sdk.md).
- **Creating an OpenHarmony project**: Create a project by using the project wizard or by importing a sample project. For details, see [Using the Project Wizard to Create a Project](use-wizard-to-create-project.md).
- **Signature configuration for debugging**: To run an OpenHarmony app on a real device, you need to sign the app first. For instructions, see [Configuring the OpenHarmony App Signature](configuring-openharmony-app-signature.md).
- **App running on a real device**: Push the OpenHarmony HAP package to the real device for installation. For details, see [Installing and Running Your OpenHarmony App](installing-openharmony-app.md).
For details about how to use DevEco Studio, see [HUAWEI DevEco Studio User Guide](https://developer.harmonyos.com/en/docs/documentation/doc-guides/tools_overview-0000001053582387).
## Restrictions<a name="section65191625782"></a>
- OpenHarmony supports only app development in eTS and JS.
- Developing OpenHarmony apps in DevEco Studio is supported on Windows.
DevEco Studio serves as a development tool for both OpenHarmony and HarmonyOS apps. Refer to the following table for descriptions about the functions not supported for OpenHarmony.
<a name="table852516933419"></a>
<table><thead align="left"><tr id="row1952618913415"><th class="cellrowborder" valign="top" width="29.882988298829883%" id="mcps1.1.4.1.1"><p id="p165268963418"><a name="p165268963418"></a><a name="p165268963418"></a>Feature</p>
</th>
<th class="cellrowborder" valign="top" width="36.783678367836785%" id="mcps1.1.4.1.2"><p id="p25262914349"><a name="p25262914349"></a><a name="p25262914349"></a>HarmonyOS</p>
</th>
<th class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.1.4.1.3"><p id="p125265912343"><a name="p125265912343"></a><a name="p125265912343"></a>OpenHarmony</p>
</th>
</tr>
</thead>
<tbody><tr id="row955132319355"><td class="cellrowborder" valign="top" width="29.882988298829883%" headers="mcps1.1.4.1.1 "><p id="p1655172423517"><a name="p1655172423517"></a><a name="p1655172423517"></a>Service widgets</p>
</td>
<td class="cellrowborder" valign="top" width="36.783678367836785%" headers="mcps1.1.4.1.2 "><p id="p1555192493516"><a name="p1555192493516"></a><a name="p1555192493516"></a><strong id="b11551102403511"><a name="b11551102403511"></a><a name="b11551102403511"></a></strong></p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="p85511324183514"><a name="p85511324183514"></a><a name="p85511324183514"></a><strong id="b255116244356"><a name="b255116244356"></a><a name="b255116244356"></a>X</strong></p>
</td>
</tr>
<tr id="row1552619933411"><td class="cellrowborder" valign="top" width="29.882988298829883%" headers="mcps1.1.4.1.1 "><p id="p11430122863614"><a name="p11430122863614"></a><a name="p11430122863614"></a>Automatic signing</p>
</td>
<td class="cellrowborder" valign="top" width="36.783678367836785%" headers="mcps1.1.4.1.2 "><p id="p243122863614"><a name="p243122863614"></a><a name="p243122863614"></a><strong id="b14431122873617"><a name="b14431122873617"></a><a name="b14431122873617"></a></strong></p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="p4431162819362"><a name="p4431162819362"></a><a name="p4431162819362"></a><strong id="b4431328163619"><a name="b4431328163619"></a><a name="b4431328163619"></a>X</strong></p>
</td>
</tr>
<tr id="row115263913344"><td class="cellrowborder" valign="top" width="29.882988298829883%" headers="mcps1.1.4.1.1 "><p id="p1323118352362"><a name="p1323118352362"></a><a name="p1323118352362"></a>Remote emulator</p>
</td>
<td class="cellrowborder" valign="top" width="36.783678367836785%" headers="mcps1.1.4.1.2 "><p id="p723143573614"><a name="p723143573614"></a><a name="p723143573614"></a><strong id="b8231173533613"><a name="b8231173533613"></a><a name="b8231173533613"></a></strong></p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="p7231435143619"><a name="p7231435143619"></a><a name="p7231435143619"></a><strong id="b1523111352363"><a name="b1523111352363"></a><a name="b1523111352363"></a>X</strong></p>
</td>
</tr>
<tr id="row183441037105115"><td class="cellrowborder" valign="top" width="29.882988298829883%" headers="mcps1.1.4.1.1 "><p id="p5345237155119"><a name="p5345237155119"></a><a name="p5345237155119"></a>Local emulator</p>
</td>
<td class="cellrowborder" valign="top" width="36.783678367836785%" headers="mcps1.1.4.1.2 "><p id="p393214320517"><a name="p393214320517"></a><a name="p393214320517"></a><strong id="b1693264315118"><a name="b1693264315118"></a><a name="b1693264315118"></a></strong></p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="p139324438515"><a name="p139324438515"></a><a name="p139324438515"></a><strong id="b169321543175116"><a name="b169321543175116"></a><a name="b169321543175116"></a>X</strong></p>
</td>
</tr>
<tr id="row15269933419"><td class="cellrowborder" valign="top" width="29.882988298829883%" headers="mcps1.1.4.1.1 "><p id="p152318351369"><a name="p152318351369"></a><a name="p152318351369"></a>Using DevEco Studio for log viewing and optimization</p>
</td>
<td class="cellrowborder" valign="top" width="36.783678367836785%" headers="mcps1.1.4.1.2 "><p id="p623118353360"><a name="p623118353360"></a><a name="p623118353360"></a><strong id="b10231535143615"><a name="b10231535143615"></a><a name="b10231535143615"></a></strong></p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="p192313353367"><a name="p192313353367"></a><a name="p192313353367"></a><strong id="b1423123514368"><a name="b1423123514368"></a><a name="b1423123514368"></a>X</strong></p>
</td>
</tr>
<tr id="row7357734143617"><td class="cellrowborder" valign="top" width="29.882988298829883%" headers="mcps1.1.4.1.1 "><p id="p76694468363"><a name="p76694468363"></a><a name="p76694468363"></a>Cloud testing</p>
</td>
<td class="cellrowborder" valign="top" width="36.783678367836785%" headers="mcps1.1.4.1.2 "><p id="p2066918465369"><a name="p2066918465369"></a><a name="p2066918465369"></a><strong id="b3669546133610"><a name="b3669546133610"></a><a name="b3669546133610"></a></strong></p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="p1266910467363"><a name="p1266910467363"></a><a name="p1266910467363"></a><strong id="b11669144693616"><a name="b11669144693616"></a><a name="b11669144693616"></a>X</strong></p>
</td>
</tr>
<tr id="row124331939191517"><td class="cellrowborder" valign="top" width="29.882988298829883%" headers="mcps1.1.4.1.1 "><p id="p146691546143619"><a name="p146691546143619"></a><a name="p146691546143619"></a>Security testing</p>
</td>
<td class="cellrowborder" valign="top" width="36.783678367836785%" headers="mcps1.1.4.1.2 "><p id="p614815145371"><a name="p614815145371"></a><a name="p614815145371"></a><strong id="b101485149375"><a name="b101485149375"></a><a name="b101485149375"></a></strong></p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.1.4.1.3 "><p id="p1514811149374"><a name="p1514811149374"></a><a name="p1514811149374"></a><strong id="b01481614133717"><a name="b01481614133717"></a><a name="b01481614133717"></a>X</strong></p>
</td>
</tr>
</tbody>
</table>
## DevEco Studio Evolution Roadmap<a name="section187875207166"></a>
Refer to the following figure for when the HUAWEI DevEco Studio support for OpenHarmony app development is available in different phases.
![](figures/en-us_image_0000001210018359.png)
# Version Change History<a name="EN-US_TOPIC_0000001210143219"></a>
- [V3.0 Beta2 \(2021-12-31\)](#section18825185716537)
- [Version Compatibility](#section8155205312218)
- [Version Change History](#section1655415918226)
- [V3.0 Beta1 \(2021-09-29\)](#section21092033115018)
## V3.0 Beta2 \(2021-12-31\)<a name="section18825185716537"></a>
### Version Compatibility<a name="section8155205312218"></a>
DevEco Studio 3.0 Beta2 is compatible with the module versions listed below.
<a name="table912419211138"></a>
<table><thead align="left"><tr id="row141241921231"><th class="cellrowborder" valign="top" width="31.009999999999998%" id="mcps1.1.4.1.1"><p id="p1112432111316"><a name="p1112432111316"></a><a name="p1112432111316"></a>Module</p>
</th>
<th class="cellrowborder" valign="top" width="36.02%" id="mcps1.1.4.1.2"><p id="p111241921039"><a name="p111241921039"></a><a name="p111241921039"></a>Version</p>
</th>
<th class="cellrowborder" valign="top" width="32.97%" id="mcps1.1.4.1.3"><p id="p863410439478"><a name="p863410439478"></a><a name="p863410439478"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row14124221933"><td class="cellrowborder" valign="top" width="31.009999999999998%" headers="mcps1.1.4.1.1 "><p id="p17124172110319"><a name="p17124172110319"></a><a name="p17124172110319"></a>Gradle</p>
</td>
<td class="cellrowborder" valign="top" width="36.02%" headers="mcps1.1.4.1.2 "><p id="p101251821838"><a name="p101251821838"></a><a name="p101251821838"></a>7.3 (7.2 at minimum)</p>
</td>
<td class="cellrowborder" valign="top" width="32.97%" headers="mcps1.1.4.1.3 "><p id="p0634643124719"><a name="p0634643124719"></a><a name="p0634643124719"></a>DevEco Studio has Gradle 7.3 preinstalled. No separate installation is required.</p>
</td>
</tr>
<tr id="row1125172118320"><td class="cellrowborder" valign="top" width="31.009999999999998%" headers="mcps1.1.4.1.1 "><p id="p358213219512"><a name="p358213219512"></a><a name="p358213219512"></a>JDK</p>
</td>
<td class="cellrowborder" valign="top" width="36.02%" headers="mcps1.1.4.1.2 "><p id="p1412552119316"><a name="p1412552119316"></a><a name="p1412552119316"></a>11.0.x</p>
</td>
<td class="cellrowborder" valign="top" width="32.97%" headers="mcps1.1.4.1.3 "><p id="p76347438478"><a name="p76347438478"></a><a name="p76347438478"></a>DevEco Studio has JDK 11 preinstalled. No separate installation is required.</p>
</td>
</tr>
<tr id="row712518211231"><td class="cellrowborder" valign="top" width="31.009999999999998%" headers="mcps1.1.4.1.1 "><p id="p61257211232"><a name="p61257211232"></a><a name="p61257211232"></a>OpenHarmony SDK</p>
</td>
<td class="cellrowborder" valign="top" width="36.02%" headers="mcps1.1.4.1.2 "><p id="p141258211631"><a name="p141258211631"></a><a name="p141258211631"></a>3.1.0.0 (API Version 8 Beta)</p>
</td>
<td class="cellrowborder" valign="top" width="32.97%" headers="mcps1.1.4.1.3 "><p id="p363464312479"><a name="p363464312479"></a><a name="p363464312479"></a>This version is compatible with SDKs of earlier versions.</p>
</td>
</tr>
<tr id="row148771316264"><td class="cellrowborder" valign="top" width="31.009999999999998%" headers="mcps1.1.4.1.1 "><p id="p16276131516263"><a name="p16276131516263"></a><a name="p16276131516263"></a>Toolchinas</p>
</td>
<td class="cellrowborder" valign="top" width="36.02%" headers="mcps1.1.4.1.2 "><p id="p887713152611"><a name="p887713152611"></a><a name="p887713152611"></a>3.1.0.0</p>
</td>
<td class="cellrowborder" rowspan="3" valign="top" width="32.97%" headers="mcps1.1.4.1.3 "><p id="p14933418194918"><a name="p14933418194918"></a><a name="p14933418194918"></a>Update them to the latest version.</p>
</td>
</tr>
<tr id="row1792520182520"><td class="cellrowborder" valign="top" headers="mcps1.1.4.1.1 "><p id="p109251518258"><a name="p109251518258"></a><a name="p109251518258"></a>hap plug-in</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.4.1.2 "><p id="p14925111817513"><a name="p14925111817513"></a><a name="p14925111817513"></a>3.0.5.2</p>
</td>
</tr>
<tr id="row29251718254"><td class="cellrowborder" valign="top" headers="mcps1.1.4.1.1 "><p id="p109255186518"><a name="p109255186518"></a><a name="p109255186518"></a>decctest plug-in</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.1.4.1.2 "><p id="p15925121819513"><a name="p15925121819513"></a><a name="p15925121819513"></a>1.2.7.2</p>
</td>
</tr>
</tbody>
</table>
### Version Change History<a name="section1655415918226"></a>
<a name="simpletable154972061571"></a>
<table id="simpletable154972061571"><tr id="strow04971366576"><td valign="top" id="stentry164971967578"><p id="p949718615570"><a name="p949718615570"></a><a name="p949718615570"></a><strong id="b3206161751212"><a name="b3206161751212"></a><a name="b3206161751212"></a>New Features</strong></p>
<a name="ul1978261655712"></a><a name="ul1978261655712"></a><ul id="ul1978261655712"><li>Introduced the Chinese UI. By default, the UI is displayed in English. To enable the Chinese UI, go to <strong id="b121121320121217"><a name="b121121320121217"></a><a name="b121121320121217"></a>Settings</strong>, choose <strong id="b7112102015129"><a name="b7112102015129"></a><a name="b7112102015129"></a>Plugins</strong> &gt; <strong id="b5112152017128"><a name="b5112152017128"></a><a name="b5112152017128"></a>installed</strong>, and select <strong id="b9113182071210"><a name="b9113182071210"></a><a name="b9113182071210"></a>Chinese (Simplified)</strong>. Then, restart DevEco Studio for the settings to take effect.</li><li>Introduced support for OpenHarmony apps and services, with various debugging features, from breakpoint management and variable observation to stepping.</li></ul>
<p id="p49051145125817"><a name="p49051145125817"></a><a name="p49051145125817"></a></p>
<p id="p7511347135817"><a name="p7511347135817"></a><a name="p7511347135817"></a><strong id="b6867529171215"><a name="b6867529171215"></a><a name="b6867529171215"></a>Enhanced Features</strong></p>
<a name="ul311913348114"></a><a name="ul311913348114"></a><ul id="ul311913348114"><li>Updated the OpenHarmony SDK to 3.1.0.0, whose API version is API 8 Beta and corresponding compilation and building plugin is 3.0.5.2.</li><li>Added an ability template that supports low-code development: <strong id="b736929122019"><a name="b736929122019"></a><a name="b736929122019"></a>[Standard]Empty Ability</strong>.</li><li>Added eTS component preview: allows previewing of eTS components; requires compileSdkVersion 8 or later.</li><li>Added eTS livee preview: allows viewing of the attribute changes in real time as you make them; requires compileSdkVersion 8 or later.</li></ul>
</td>
</tr>
</table>
## V3.0 Beta1 \(2021-09-29\)<a name="section21092033115018"></a>
<a name="simpletable19435134375015"></a>
<table id="simpletable19435134375015"><tr id="strow1435543185020"><td valign="top" id="stentry64351943115013"><div class="p" id="p13974162220455"><a name="p13974162220455"></a><a name="p13974162220455"></a><strong id="b0838112318282"><a name="b0838112318282"></a><a name="b0838112318282"></a>New Features</strong><a name="ul11381034104515"></a><a name="ul11381034104515"></a><ul id="ul11381034104515"><li>Added support for OpenHarmony SDK management. You can use SDK Manager to download and manage OpenHarmony SDKs.</li><li>Allowed for building of a single module during HAP compilation and building to accelerate building for multi-module projects; allowed for one-click re-building of HAPs, by automatically conducting the Clean Project operation before a HAP build.</li></ul>
</div>
<div class="p" id="p556811306614"><a name="p556811306614"></a><a name="p556811306614"></a><strong id="b0183135142820"><a name="b0183135142820"></a><a name="b0183135142820"></a>Enhanced Features</strong><a name="ul834518400613"></a><a name="ul834518400613"></a><ul id="ul834518400613"><li>Updated the compilation and building plugin to version 3.0.3.2.</li><li>Improved the JSON editor, which now enables quick rectification of resource index errors and instant access to resource values.</li><li>Provided Ohos and Project (default) views for projects, which you can switch between easily.</li><li>Enabled OpenHarmony projects to support Ark build.</li><li>Moved the <strong id="b19966587296"><a name="b19966587296"></a><a name="b19966587296"></a>supportSystem "standard"</strong> field, which is exclusive to OpenHarmony projects, from the module-level <strong id="b596638162911"><a name="b596638162911"></a><a name="b596638162911"></a>build.gradle</strong> file to the project-level <strong id="b199671680295"><a name="b199671680295"></a><a name="b199671680295"></a>build.gradle</strong> file.</li></ul>
</div>
</td>
</tr>
</table>
# DevEco Studio \(OpenHarmony\) User Guide<a name="EN-US_TOPIC_0000001163049851"></a> # DevEco Studio \(OpenHarmony\) User Guide
- **[Overview](deveco-studio-overview.md)**
- **[Version Change History](deveco-studio-release-notes.md)**
- **[Configuring the OpenHarmony SDK](configuring-openharmony-sdk.md)**
- **[Creating an OpenHarmony Project](create-openharmony-project.md)**
- **[Configuring the OpenHarmony App Signature](configuring-openharmony-app-signature.md)**
- **[Installing and Running Your OpenHarmony App](installing-openharmony-app.md)**
因为 它太大了无法显示 image diff 。你可以改为 查看blob
因为 它太大了无法显示 image diff 。你可以改为 查看blob
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册