A wearable is a wrist-worn device that provides communication capabilities and data interaction with mobile devices. It includes both adult smartwatches and children's smartwatches. Wearables have the following key characteristics:
Currently, the main wearable products include WATCH 5, WATCH Ultimate 2, and the HUAWEI WATCH KIDS X series.
Product Name | Illustration |
|---|---|
WATCH 5 |
|
WATCH Ultimate 2 |
|
HUAWEI WATCH KIDS X series |
|
Wearables do not support screen rotation. The screen rotation angle is fixed at 0°, and the default screen orientation is portrait. The following table uses WATCH 5 and HUAWEI WATCH KIDS X1 Pro as examples to show their display specifications.
Product Name | Display Specifications (Width × Height) | Illustration |
|---|---|---|
WATCH 5 | Resolution (vp, rounded down): 233 × 233 |
|
Resolution (px): 466 × 466 | ||
HUAWEI WATCH KIDS X1 Pro | Resolution (vp, rounded down): 240 × 204 |
|
Resolution (px): 480 × 408 |
For other wearable products, you can obtain the display resolution (in pixels) by calling getDefaultDisplaySync() in the display module, and then convert it to vp using px2vp().
Some wearable products (such as HUAWEI WATCH KIDS X series) are equipped with both front and rear cameras. When developing camera-related features, pay attention to the camera mounting angle and the preview stream rotation angle. For details, see Camera Lens Installation Angle and Preview Rotation Angle. The camera parameters are listed in the following tables.
Screen rotation (rotation) | 0 (0°) | 1 (90°) | 2 (180°) | 3 (270°) |
|---|---|---|---|---|
Front camera illustration |
| Not supported | Not supported | Not supported |
Front camera lens angle | 0° | Not supported | Not supported | Not supported |
Preview stream rotation angle of the front camera | 0° | Not supported | Not supported | Not supported |
Screen rotation (rotation) | 0 (0°) | 1 (90°) | 2 (180°) | 3 (270°) |
|---|---|---|---|---|
Rear camera illustration |
| Not supported | Not supported | Not supported |
Rear camera lens angle | 0° | Not supported | Not supported | Not supported |
Preview stream rotation angle of the rear camera | 0° | Not supported | Not supported | Not supported |
The crown (upper button) on a wearable supports both press and rotation interactions. Rotating the crown provides real-time interaction feedback. The system handles crown rotation events through the onDigitalCrown() callback and provides built-in crown interaction support for commonly used components.
Key features:
Text(this.count.toString())
// ...
.onDigitalCrown((event: CrownEvent) => {
event.stopPropagation();
this.count += event.degree;
}) The following components support crown interaction by default:
You can customize crown event handling through the provided APIs to deliver richer interaction experiences. For details about developing crown interactions on wearables, see Crown Event.
Smart gestures are a unique interaction method available on wearables in addition to touchscreen, crown, and button interactions. In situations where one-handed operation is required, users can control the wearable and switch selections by tapping their fingers or sliding their knuckles.
Interaction scenarios
Gesture types
How it works: After the system recognizes the gesture, it triggers the component's onKeyEvent event with KeyCode.KEYCODE_ENTER as the key code and KeyType.Down as the event type. The app can perform the corresponding action when these conditions are met, such as pausing music.
Sample code:
.onKeyEvent((event: KeyEvent) => {
if (event.keyCode === KeyCode.KEYCODE_ENTER && event.type === KeyType.Down) {
// Trigger the pinching gesture
this.oneButton1Color = '#ffe3ba51';
this.oneButton1Text = 'Confirm';
}
}) 
How it works: After the system recognizes the gesture, it triggers the onBlur event on the component losing focus and the onFocus event on the component gaining focus. The app can perform the corresponding actions when these events are triggered, such as highlighting the focused component by changing its style.
Sample code:
.onFocus(() => {
this.oneButton1Color = '#ff57c853';
this.oneButton1Text = 'Hover';
this.oneButton2Text = 'Two';
})
.onBlur(() => {
this.oneButton1Color = '';
this.oneButton1Text = 'One';
}) 
Smart gesture interactions require the target component to have focus. First, call activate to activate the focus state for the current page.
this.getUIContext().getFocusController().activate(true, false);
After the focus state is activated, call requestFocus() to assign focus to the target component. Smart gesture interactions are then enabled. The following example sets the button whose ID is btn1 to receive focus by default after the page is rendered.
// register a button to get focus by default.
this.getUIContext().getFocusController().requestFocus('btn1'); When the page is exited, set the focus activation state of the current page to false.
aboutToDisappear(): void {
this.getUIContext().getFocusController().activate(false);
} To extend the battery life of wearables and provide users with a longer-lasting and smoother experience, follow these recommendations.

If your app needs to keep the screen on in scenarios such as navigation or video playback, implement the feature as follows.
onWindowStageCreate(windowStage: window.WindowStage): void {
let windowClass: window.Window | undefined = undefined;
window.getLastWindow(this.context, (err: BusinessError, data: window.Window) => {
const errCode: number = err.code;
if (errCode) {
hilog.error(0x0000, TAG, 'Failed to obtain the top window. Cause: ' + JSON.stringify(err));
return;
}
windowClass = data;
hilog.info(0x0000, TAG, 'Succeeded in obtaining the top window. Data: ' + JSON.stringify(data));
AppStorage.setOrCreate('windowClass', windowClass);
});
// ...
} // Window object obtained from EntryAbility, which is used to ensure that the screen is steady on during navigation.
@StorageLink('windowClass') windowClass: window.Window | undefined = undefined;
// ...
aboutToAppear(): void {
// ...
if (this.windowClass) {
this.windowClass.setWindowKeepScreenOn(true, (err: BusinessError) => {
const errCode: number = err.code;
if (errCode) {
hilog.error(0x0000, TAG,
`Failed to set the screen to be always on. Cause code: ${err.code}, message: ${err.message}`);
return;
}
hilog.info(0x0000, TAG, 'Succeeded in setting the screen to be always on.');
});
}
} Communication between a phone and a wearable is a core development scenario for wearable apps. Wear Engine provides standardized APIs for implementing cross-device interactions. The basic development process is as follows:
export class ConnectUtil {
// Peer communication device entity class object
device?: wearEngine.Device;
// Unique ID of the peer communication device.
deviceRandomId?: string;
// Used to obtain linked devices
deviceClient?: wearEngine.DeviceClient;
// ...
constructor(context: Context) {
if (canIUse('SystemCapability.Health.WearEngine')) {
this.deviceClient = wearEngine.getDeviceClient(context);
// ...
}
}
// ...
} // Obtains the information about the peer device connected to the peer device
// and listens on the communication between the peer device and the peer device.
async getConnectedDevices(): Promise<void> {
try {
if (canIUse('SystemCapability.Health.WearEngine')) {
let devices: wearEngine.Device[] = await this.deviceClient?.getConnectedDevices() as wearEngine.Device[];
this.device = devices[0];
this.deviceRandomId = devices[0].randomId;
}
await this.registerMessageReceiver();
} catch (err) {
hilog.error(0x0000, TAG, 'getConnectedDevices is err' + JSON.stringify(err));
}
} export class ConnectUtil {
// ...
// Used to p2p
p2pClient?: wearEngine.P2pClient;
// ...
constructor(context: Context) {
if (canIUse('SystemCapability.Health.WearEngine')) {
// ...
this.p2pClient = wearEngine.getP2pClient(context);
}
}
// ...
} // Callback Method for Listening to Peer Communication.
private onMsgCallback: Callback<wearEngine.P2pMessage> = (data: wearEngine.P2pMessage): void => {
// Decodes the intercepted content into a character string.
let decoder: util.TextDecoder = util.TextDecoder.create();
if (canIUse('SystemCapability.Health.WearEngine')) {
let str: string = decoder.decodeToString(data.content);
promptAction.openToast({
message: 'message: ' + str,
duration: 2000
});
}
}
// Listening to the communication between the peer end.
async registerMessageReceiver(): Promise<void> {
try {
if (canIUse('SystemCapability.Health.WearEngine')) {
await this.p2pClient?.registerMessageReceiver(this.deviceRandomId, appParam, this.onMsgCallback);
hilog.info(0x0000, TAG, 'registerMessageReceiver is ok');
}
} catch (err) {
hilog.error(0x0000, TAG, 'registerMessageReceiver is err ', JSON.stringify(err));
}
}
// Disabling the interception of peer communication.
async unregisterMessageReceiver(): Promise<void> {
try {
if (canIUse('SystemCapability.Health.WearEngine')) {
await this.p2pClient?.unregisterMessageReceiver(this.deviceRandomId, appParam, this.onMsgCallback);
hilog.info(0x0000, TAG, 'unregisterMessageReceiver is ok');
}
} catch (err) {
hilog.error(0x0000, TAG, 'unregisterMessageReceiver is err ', JSON.stringify(err));
}
} // Method of sending messages to the peer end
async sendMessage(message: string): Promise<void> {
try {
let p2pMessage: wearEngine.P2pMessage = this.getP2pMessage(message);
if (canIUse('SystemCapability.Health.WearEngine')) {
let value = await this.p2pClient?.sendMessage(this.deviceRandomId, appParam, p2pMessage);
hilog.info(0x0000, TAG, 'sendMessage value is' + JSON.stringify(value))
}
} catch (err) {
hilog.error(0x0000, TAG, 'sys sendMessage is err ' + JSON.stringify(err));
}
}
Notifications on wearables can originate from the following sources:
Phone app notifications
In the Huawei Health app, open the notification settings page and enable notification access for the desired phone apps. Notifications from those apps are then synchronized to the paired Huawei wearable in real time.
Phone-initiated notifications
A phone app can proactively send notifications to a wearable by calling notify() in Wear Engine. The development process is as follows:
// Used to notify message notifyClient: wearEngine.NotifyClient | undefined;
Obtain the client of the Notify module using the context of the ability where the current component resides.
try {
this.connectUtils.notifyClient = wearEngine.getNotifyClient(this.getUIContext().getHostContext());
} catch (err) {
hilog.error(0x0000, TAG,
`Failed to get notify client. Cause code: ${err.code}, message: ${err.message}`);
} /*
* Method of notifying a message to watch.
*/
notifyMessage() {
// Configure the notification content.
// Including the package name of the notification source, notification title, and notification content.
let type1Notification: wearEngine.Notification = {
type: wearEngine.NotificationType.NOTIFICATION_WITHOUT_BUTTONS,
bundleName: 'com.example.smartwatchmapnavigation',
title: 'smartwatchmapnavigation',
text: 'walk navigation start',
}
let options: wearEngine.NotificationOptions = {
notification: type1Notification,
onAction: (feedback: wearEngine.NotificationFeedback) => {
hilog.info(0x000, TAG,
`one button notify get feedback is ${feedback.action ? feedback.action : feedback.errorCode}`);
}
}
// Sends a notification to the watch based on notifyClient.
// This method can be invoked only by apps on mobile phones.
this.notifyClient!.notify(this.deviceRandomId, options).then(result => {
hilog.info(0x000, TAG, `Succeeded in sending notification.`);
}).catch((error: BusinessError) => {
hilog.error(0x000, TAG, `Failed to send notification. Code is ${error.code}, message is ${error.message}`);
})
}
Calling NotifyClient.notify() in Wear Engine requires the Wear Engine permission. For details, see Applying for Wear Engine Kit Integration.
Local wearable notifications
A wearable app can publish local notifications through the NotificationManager module.
You can determine whether the user has granted authorization based on the error code returned by requestEnableNotification. An error code of 1600004 indicates that the user has denied the authorization request.
aboutToAppear() {
let context = this.getUIContext().getHostContext() as common.UIAbilityContext;
notificationManager.isNotificationEnabled().then((data: boolean) => {
hilog.info(DOMAIN_NUMBER, TAG, "isNotificationEnabled success, data: " + JSON.stringify(data));
if (!data) {
notificationManager.requestEnableNotification(context).then(() => {
hilog.info(DOMAIN_NUMBER, TAG, `[ANS] requestEnableNotification success`);
}).catch((err: BusinessError) => {
if (1600004 == err.code) {
hilog.error(DOMAIN_NUMBER, TAG,
`[ANS] requestEnableNotification refused, code is ${err.code}, message is ${err.message}`);
} else {
hilog.error(DOMAIN_NUMBER, TAG,
`[ANS] requestEnableNotification failed, code is ${err.code}, message is ${err.message}`);
}
});
}
}).catch((err: BusinessError) => {
hilog.error(DOMAIN_NUMBER, TAG, `isNotificationEnabled fail, code is ${err.code}, message is ${err.message}`);
});
} Button ('Notification sending')
.onClick(()=>{
let notificationRequest: notificationManager.NotificationRequest = {
id: 1,
content: {
// General text type notification.
notificationContentType: notificationManager.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: 'test_title',
text: 'test_text',
additionalText: 'test_additionalText',
}
}
};
notificationManager.publish(notificationRequest, (err: BusinessError) => {
if (err) {
hilog.error(DOMAIN_NUMBER, TAG, `Failed to publish notification. Code is ${err.code}, message is ${err.message}`);
return;
}
hilog.info(DOMAIN_NUMBER, TAG, 'Succeeded in publishing notification.');
});
})
As capability support varies across devices, use canIUse to check whether the required capability is supported before calling the corresponding APIs. This helps ensure app stability and prevents crashes caused by compatibility issues. For details, see Multi-Device Application Development.
Apps for children's smartwatches are designed for child users. Apps in categories such as early education, content consumption, social interaction, audio and video, and games should carefully evaluate the requirements for protecting minors. If your app needs to adjust its content, feature entry points, or usage duration based on the system's minor mode, adapt your app to support this capability.
For APIs related to minor mode, see the minorsProtection capability in Account Kit. Depending on your app scenario, you can obtain the minor mode status, retrieve the user's age group, or guide users to enable minor mode.
How Do I Debug an App on a Wearable?
Problem: After obtaining a wearable, you may not know how to deploy and debug your app on the device.
Solution: Wearables support Wi-Fi wireless debugging with automatic signing. Follow these recommendations when debugging:
How Do I Configure a Wearable App Project?
Problem: You may not know which project configurations are required for wearables or how the project configuration differs between adult smartwatches and children's smartwatches.
Solution: To develop an app for a wearable, set deviceTypes to wearable in the module section of the module.json5 file. If your project currently targets lightweight smartwatches and you want to migrate it to support adult smartwatches, see FA Project Migration.
For adult smartwatch apps, no additional configuration is required after completing the preceding steps. For children's smartwatch apps, you must also configure the distribution policy for children's smartwatches. In addition, ensure that DevEco Studio 6.1.0 Release or later is installed. Perform the following steps:
{
"distributionFilter": {
"screenShape": {
"policy": "include",
"value": [
"rect"
]
},
"screenWindow": {
"policy": "include",
"value": [
"480*408"
]
}
}
} {
"module": {
"deviceTypes": [
"wearable"
],
"metadata": [
{
"name": "string",
"value": "string",
"resource": "$profile:distributionFilter_config"
}
],
"requiredDeviceFeatures": {
"wearable": [
"child"
]
}
}
} {
"targetSdkVersion": "6.1.0(23)",
"compatibleSdkVersion": "6.1.0(23)"
} For app projects developed using the layered architecture based on the "One-Time Development for Multi-Device Deployment" paradigm, how should HAP packages for wearables and other device types be managed?
Problem: You may not know how to manage HAP packages when your app uses the "One-Time Development for Multi-Device Deployment" paradigm to manage phone and wearable apps within a single project.
Solution: Since apps on wearables often differ significantly from those on other devices in terms of UI design and functionality, it is recommended that separate HAP packages be used for precise adaptation.
For details, see the content related to the product customization layer in Layered Architecture Design.
Watch app release precautions
Problem: You may have questions about releasing a watch app that targets wearables and lite wearables.

Solution:

In addition to the preceding procedure, child smartwatch apps are subject to additional review requirements and submission materials. For details, see Child Smartwatch App Release Precautions.
The app works properly on one wearable but crashes or a feature does not respond on another wearable.
Problem: You may find that your app works properly on one wearable but crashes, exits unexpectedly, or a feature does not respond on another wearable.
Possible cause: Different wearables vary in hardware configurations and supported system capabilities. Your app may not be fully adapted to these device differences.
Solution:
Synchronous or asynchronous APIs do not work properly after migrating an FA project.
Problem: You may find that synchronous or asynchronous APIs no longer work properly after migrating your project.
Solution: Update the API invocation pattern. For example, for the huks.generateKeyItem() API, change the original implementation:
huks.generateKeyItem(alias, options, callback);
to:
try {
const data = await huks.generateKeyItem(alias, options);
// Result of successful processing.
} catch (error) {
// Capture and handle exceptions.
} Communication with the phone stops working after migrating an FA project.
Problem: You may find that communication between the wearable app and the phone no longer works after migrating your FA project.
Possible cause: The app uses fingerprint information to authenticate inter-app communication. After migration, the app ID changes. If the fingerprint in the configuration file is not updated, communication fails.
Solution: Run the "hdc shell bm dump –n YourBundleName | grep appIdentifier" command to obtain the app ID of the wearable app, and update the fingerprint value in the configuration files of both the wearable app and the phone app.
Child smartwatch apps are subject to additional review requirements and submission material requirements during release.
The general release configuration and process are described in Releasing a HarmonyOS App. In addition to meeting the release requirements for wearable apps, child smartwatch apps must also meet the following additional requirements:
The following sections describe these requirements in detail.
Before developing a child smartwatch app, send an email with the subject Huawei Child Smartwatch App Onboarding Application to developer@huawei.com. Include the following information in the email. If you have already contacted a Huawei representative, you can submit the required information directly to the representative, who will configure the app trustlist. Huawei representatives include Business Development (BD) and Solution Architect (SA) contacts.
App name | xxx |
Bundle name | xxx.xxx.xxx |
App version | xxx |
App ID | xxx (For details about how to create an app ID, see Creating an App ID for a HarmonyOS App.) |
Target wearable | Child smartwatches only; or adult smartwatches and child smartwatches. |
Is the app name the same as that of the adult smartwatch app? | Yes/No (If the app name is the same, the package name must be different.) |
Is the app name the same as that of apps on phones, tablets, PCs, or other device types? | Yes/No (If the app name is the same, the package name must be different.) |
Developer name | xxx |
Additional information (required) | Include an app introduction, the percentage of free content, a description of app features, and any other relevant information. The format is not restricted. |
The application result will be provided within 10 working days.
After your application is approved, evaluate and develop your app in accordance with the Third-Party App Rules for HUAWEI WATCH KIDS. After development is complete, send the self-check acknowledgment for the rules to developer@huawei.com.
After the child smartwatch app is developed, select smartwatch as the device type when submitting the app. Child smartwatch apps are submitted under the smartwatch category. For the general release configuration and submission process, see Releasing a HarmonyOS App. During submission, ignore the following dialog box and click Confirm or close the dialog box to continue.

Category: Select the appropriate category based on your app's characteristics (for example, Music, Entertainment, or Kids). Selecting the Apps/Kids category is optional.

App tags: Select at least one tag as the primary app tag based on your app's characteristics. You can optionally select one or more additional tags. Selecting the Kids tag is optional.

Wearables are compatible with the FA model. This section describes how to migrate a lite wearable project developed with JS to wearables, enabling the app to continue working after migration and adapt to the new device type.
Using a lite wearable app as an example, the following steps describe how to migrate a JS-based project to wearables:


Right-click the Project directory and choose New > Module from the shortcut menu to create a module.

Select Empty Ability and click Next.

Retain the default settings and click Next.

To make the project compatible with wearables, you need to change Ability name to HiWearMainAbility. Click Finish. The module compatible with wearables has been created.

Delete the entry module created by default. The basic framework for porting a lite wearable project has been created.


After migrating the files, modify config.json. Modify the reference of resource files. If there are new page files in the pages directory, add them to the config.json file. Change the value of designWidth to 466.

Add the required permissions to the config.json file. If the vibration function is used in the original project, add the vibration permission.

huks.generateKeyItem(alias, options, callback);
The callback is executed synchronously on a lite wearable, but asynchronously on a wearable. Therefore, you need to add await to the code to ensure that the code is executed synchronously on wearables:
try {
const data = await huks.generateKeyItem(alias, options);
// Result of successful processing.
} catch (error) {
// Capture and handle exceptions.
}