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

Handling Mouse and Keyboard Interactions in HarmonyOS ArkUI

HarmonyOS ArkUI provides a structured event system for capturing peripheral input. Effective UI development requires precise management of pointer tracking, visual feedback, and hardware keyboard interception. Pointer Hover Detection The onHover modifier monitors when a pointing device enters or exits a component's bounding box. It supplies a b ...

Posted on Sun, 17 May 2026 05:58:08 +0000 by spirp

Building an Audio Recorder and Player Application with HarmonyOS

HarmonyOS provides comprehensive multimedia capabilities for capturing and reproducing audio content through the AudioRecorder and AudioPlayer modules. This implementation demonstrates a complete voice recording application that handles audio capture, file persistence, media library management, and playback controls. Core Concepts The AudioReco ...

Posted on Sat, 09 May 2026 08:23:49 +0000 by PhillNeedsHelp

Implementing Worker Threads in HarmonyOS ArkTS

Worker Thread InitializationImport the worker module and instantiate a thread. For API version 9 and later, utilize ThreadWorker. Earlier versions rely on the deprecated Worker class.import worker from '@ohos.worker'; // API 9+ instantiation const backgroundTask: worker.ThreadWorker = new worker.ThreadWorker('entry/ets/workers/TaskProcessor.et ...

Posted on Thu, 07 May 2026 23:03:35 +0000 by freewholly