Obtaining Device Information in Harmony OS Lite wearable

Harmony OS is a future-proof distributed operating system open to you as part of the initiatives for the all-scenario strategy, adaptable to mobile office, fitness and health, social communication, and media entertainment, to name a few.

RChancha
Huawei Developers

--

Unlike a legacy operating system that runs on a standalone device, Harmony OS is built on a distributed architecture designed based on a set of system capabilities. It can run on a wide range of device forms, including smartphones, tablets, wearables, smart TVs and head units.

In this article, we will create simple lite wearable JS application to obtain device information.

Requirements

1) DevEco IDE

2) Lite wearable simulator

Implementation

First page, index.hml contains <swiper> container that enables the switch of child components.

index.css has style defined for the page.

First, we need to import the device module in index.js.

To obtain the device information, we will call device.info()

Code Snippet of index.js

Tips and Tricks

Not all the information can be obtained on simulator. Hence it is recommended to use physical Harmony OS wearable watch.

Conclusion

In this article, we learnt how easily we can obtain wearable device information such as brand, product, device dimension, density, etc.

References

--

--