Exporting C++ Class Objects via Node-API and Managing Their Lifecycle

Sample Project Source Code Analysis The sample project uses a Native C++ template with the Stage model. This analysis focuses on key implementation files for class object export and lifecycle management. Class Definition and Method Implementation NapiTest.h Header File #ifndef __NAPI_TEST_H__ #define __NAPI_TEST_H__ #include "napi/native_ ...

Posted on Thu, 11 Jun 2026 18:28:49 +0000 by itworks

HarmonyOS App Development with Java: A Quick Start

Development Environment The official IDE for HarmonyOS is DevEco Studio, which, like Android Studio, is built upon the open-source IntelliJ IDEA Community Edition from JetBrains. The user interface is nearly identical to what Android developer are already familiar with. Currantly, DevEco Studio only supports Windows; Mac users will need a Windo ...

Posted on Mon, 08 Jun 2026 18:20:05 +0000 by Whetto

Implementing Radio Buttons in HarmonyOS ArkUI

Handling Radio Button Events In HarmonyOS ArkTS, the Radio component allows users to select one option from a group. Each radio button must share the same group value to ensure mutual exclusivity. Event handling is done via the .onChange() modifier. // Example: Basic Radio Group with Logging import router from '@ohos.router'; @Entry @Component ...

Posted on Sun, 07 Jun 2026 17:31:14 +0000 by perry789

Implementing Custom Notifications in HarmonyOS

Overview This example demonstrates how to create and manage various types of notifications using @ohos.notificationManager and related APIs. It covers publishing, canceling, and setting badge counts on the desktop for different notification formats including basic, long text, multi-line, image-based, button-enabled, and app-launching notificati ...

Posted on Sat, 06 Jun 2026 17:39:35 +0000 by forcer

Working with Application Context in HarmonyOS Stage Model

In the Stage model, different contexts offer varying scopes of data and capabillities. AbilityStageContext extends the base Context by exposing HapModuleInfo and Configuration details specific to the module stage. Meanwhile, ApplicationContext serves as the global hub, allowing deveolpers to monitor ability lifecycles, memory shifts, and system ...

Posted on Fri, 05 Jun 2026 18:08:11 +0000 by puritania

Building a Decoupled Custom Dialog System with ArkUI's Navigation.Dialog

Custom dialogs are essential in mobile application interfaces, covering modal, semi-modal, toast, and other overlay styles. A well-designed dialog component should be independent of specific UI pages and easily triggered from business logic. Common real-world needs include: Triggering dialogs from shared services (login prompts, full-screen ad ...

Posted on Wed, 03 Jun 2026 16:24:26 +0000 by sitorush

HarmonyOS ArkUI Event Handling: Mouse and Keyboard Events

Mouse Events The onMouse event handler responds to various user interactions with the mouse interface. This callback function triggers when users perform mouse actions on the UI, enabling developers to capture and respond to mouse clicks, movements, scrolling, hovering, and other mouse-related operations. The syntax for the onMouse event handle ...

Posted on Tue, 19 May 2026 06:32:44 +0000 by bdamod1

Implementing Media Session (Provider) with HarmonyOS

Overview This sample demonstrates the media session provider functionality using the @ohos.multimedia.avsession API. It enables custom data exchange between a media provider and a media controller. Note: This sample only shows the provider side. For the complete custom interaction feature, use both the provider and controller samples together. ...

Posted on Tue, 19 May 2026 01:48:08 +0000 by ManicMax

Essential HarmonyOS Utilities for Data Persistence and Media Selection

Data Persistence Management To handle lightweight data storage efficiently, we can encapsulate the dataPreferences API into a reusable utility class. This abstraction simplifies the process of reading and writing key-value pairs, such as user settings or session tokens. import preferences from '@ohos.data.preferences'; import common from '@oho ...

Posted on Mon, 18 May 2026 12:29:23 +0000 by PastorHank

Implementing UIAbility Navigation in HarmonyOS Applications

Obtaining UIAbility Context In HarmonyOS development, you can retrieve the current ability's context directly within EntryAbility, or obtain the UIAbility instance information from any Page component. Configuring Want Parameters The Want object contains several configuration parameters. The two essential parameters are: bundleName: The target ...

Posted on Mon, 18 May 2026 09:50:53 +0000 by *Lynette