Huawei HarmonyOS API: Key SDK changes, Java API, JS API, configuration files

Huawei officially launched the Harmony OS on June 2, 2021, its in-house operating system, a replacement for Android. The company announced a new watch – Watch 3 Series, a new tablet – MatePad Pro 10.8 & 12.6, and a new phone powered by HarmonyOS. The company has also shared a list of 100 different Huawei phone models to upgrade with Harmony OS over the next year.

Huawei has two different operating systems that it calls “HarmonyOS.” First is the IoT and smartwatch version of HarmonyOS, which is based on Huawei’s LiteOS and is open source. The second version of Harmony OS is for phones and tablets and is a fork of Android and uses the Linux kernel.

The HarmonyOS API has been continuously expanded and improved, with more available functions and more powerful. But every time the version is updated, developers have to find out which APIs are added in the new version by themselves, which actually takes a lot of time.

Huawei responded that it brought the first API difference report this time. This report is based on API 6. It will provide you with version introduction, key SDK change instructions, etc., including Java API, JS API and configuration files.

Huawei HarmonyOS Phone

Version introduction:

HarmonyOS SDK 2.2 Beta 1 is released this time. Compared with the previous version, please refer to [Java API Difference Report (API 6 -> API 5)] and [JS API Difference Report (API 6 -> API 5)] for API changes.

● Java API difference report (API 6 -> API 5)

https://developer.harmonyos.com/cn/docs/documentation/doc-releases/apidiff-java-api-6-0000001123842928

● JS API difference report (API 6 -> API 5)

https://developer.harmonyos.com/cn/docs/documentation/doc-releases/apidiff-js-api-6-phone-component-0000001170697425

The key changes to the SDK are explained as follows:

❖ Java API part:

◆ Added the StartAbility interface that supports callbacks, which is mainly used in installation-free scenarios to facilitate developers to obtain the callback results of StartAbility.

◆ Added the function of providing background agent timing reminder and related interfaces, which can be used for system reminders of countdown, calendar, and alarm after the application is frozen or exited.

◆ Added the response interface when the provider of the service card receives the notification of the query card status initiated by the card service provider.

◆ Added an interface that provides file sharing capabilities in the application sandbox for sharing files in the sandbox.

❖ JS API part:

◆ div component function changes: the layout of the root node div no longer fills the full screen, but is set according to the size of the child nodes. For details, please refer to [div component function changes].

● div component function changes

https://developer.harmonyos.com/cn/docs/documentation/doc-releases/changelog-api-6-0000001170522589#section292715611144

◆ General style margin function change: When the component has set the percentage width and height and margin at the same time, there will be different layouts in API 5 and API 6. For details, please refer to [General Style Margin Function Changes].

● General style margin function changes

https://developer.harmonyos.com/cn/docs/documentation/doc-releases/changelog-api-6-0000001170522589#section168737911175

◆ Added APIs that provide several subsystems such as meta-capabilities, graphics, files, etc. For details, please refer to the JS API Difference Report (API 6 -> API 5).

❖ Configuration file section

In the configuration file config.json, the configuration method of the version.name and version.code fields have been modified. It is recommended that the application use a four-segment version number and the strong association relationship between the version.code field and the version.name field has been canceled.

Huawei HarmonyOS API SDK

(Via)

Join_Huawei_Update_Telegram_Channel

Related Posts

Leave a Comment