目录

Samples

To facilitate developers to develop key functions or scenarios, this page summarizes the current sample resources, as shown in the following table:

Application Framework

[h2]Ability Kit

Name

Overview

Device Type

UIAbility Launch Mode

This sample demonstrates the implementation of the multiton, singleton, and specified ability launch modes in the stage model.

Phone

Stage Model

This sample demonstrates the ability management capabilities of the stage model based on Ability Kit.

Phone

Multi-HAP Development

This sample shows how to develop an app with multiple HAPs. The app in this sample has an entry HAP and two feature HAPs, which provide audio and video playback components. The entry module also uses the audio and video playback components. There are three HAPs for three modules and a main entry HAP to be installed on the device.

Phone

[h2]ArkData

Name

Overview

Device Type

Preferences

This sample shows how to use the APIs provided by the @ohos.data.preferences module to persistent preferences data.

Phone

Database Update

This sample shows how to perform operations on a relational database (RDB) store, including adding, deleting, modifying, and querying data and performing database transactions.

Phone

Accelerating App Cold Start by Caching Home Page Data

This sample shows how to accelerate app cold start by caching home page data.

Phone

[h2]ArkTS

Name

Overview

Device Type

Language Base Class Library

This sample shows the basic functions of each sub-module of the language base class library.

Phone

N-Body Simulation Program

In this sample, the ArkTS programming language is used to develop the N-body simulation program for the industry programming language benchmark test item Benchmarks Game to implement orbit calculation for Jupiter-like bodies.

Phone

Multi-Thread Task

This sample uses the @ohos.taskpool and @ohos.worker APIs to show how to start the worker and taskpool threads.

Phone

Sendable Use Cases

This sample demonstrates the following use cases of sendable data: multi-thread collaboration (log and dotting) in producer-consumer pattern, and cross-thread communication and UI status update implemented through sendable objects.

Phone

Cross-language Complex Parameter Interaction

This sample shows how to pass and call complex data types, including uint8Array, object, hashMap, pixelMap, and class, between ArkTS and C++.

Phone

[h2]ArkUI

Name

Overview

Device Type

HMOS World

Leveraging the best practices of layered architecture and modular design, along with HarmonyOS's distinctive capability of one-time development for multi-device deployment, this sample showcases an app that embodies the latest technical features of HarmonyOS, empowering developers in the HarmonyOS ecosystem.

Phone

State Management

This sample uses page-level and app-level state variables to manage app status.

Phone

Component Collection

This sample shows the ArkUI component collection, which includes the component, universal, animation, and global method modules.

Phone

Videos in the Media Library

This sample demonstrates the basic features of the Video component, including video componentization, full-screen display, window display, and video rotation.

Phone

Typical Setting Page

This sample shows a typical page for setting an application. The page has different display effects in the small window and large window, reflecting the capability of one-time development for multi-device deployment.

Phone

Multi-Column Control

This sample shows the responsive change effect of the multi-column control in various scenarios.

Phone

Navigation Bar

This sample shows the style of the navigation component in different device forms.

Phone

Simple Clock

This sample describes how to implement a simple clock app with the @ohos.display API and Canvas component.

Phone

Pattern Lock Component

This sample shows how to use the component to implement password setting, verification, and resetting.

Phone

2D List of UI Framework

This sample shows how to implement a list that responds to both horizontal and vertical scrolling through nested component scrolling.

Phone

News Page for Multi-Device Deployment

This sample implements a news page based on the adaptive layout and responsive layout, allowing the same set of codebase to fit into device of different sizes, such as mobile phones, foldable devices, and tablets.

Phone

Custom Keyboard for Securities Codes

This sample shows how to implement a custom keyboard application that allows securities codes such as 300 and 600 to be entered with a single tap.

Phone

App Navigation Design

This sample uses an independent router module and dynamic loading method to resolve the issue of routing dependency coupling between multiple HARs/HSPs under a Navigation component.

Phone

List Nested Sliding

This sample uses the scrollToIndex method of the List component to implement nested sliding of multiple List components.

Phone

Web Nested Sliding

This sample showcases an article detail display case where a Web component is nested within a Scroll component and the nestedScroll attribute is used to intercept the scrolling action.

Phone

Scroll Nested Sliding

In this sample, the nestedScroll attribute is used to implement the function of sliding up the Scroll container to the Tabs subcomponent. The Tabs subcomponent is mounted to the top, and the content in the List subcomponent can continue to slide.

Phone

List Editing

This sample uses the List component to implement the list editing effects in scenarios such as to-do list management, file management, and notepad.

Phone

Adding and Deleting Tab Tags Using the Tab Component

This sample describes how to use the tab component to add or delete a tab and mainly applies to scenarios such as browsers.

Phone

Common Tab Navigation Styles

This sample provides common tab navigation UI styles, including bottom navigation, top navigation, and side navigation.

Phone

Custom Dialog Set

This sample uses CustomDialog, bindContentCover, and bindSheet to implement multiple custom dialog pop-ups.

Phone

Component Stacking

This sample describes how to use component stacking to build multi-layer stack visual effects. You can use the onScrollFrameBegin event callback function of the Scroll component to accurately capture the scrolling action. During scrolling, attributes such as transparency and height of the component are adjusted in real time, to implement nested scrolling effects, dynamic changing of transparency, and smooth component switching.

Phone

WaterFlow Instance

This sample describes how to implement the waterfall layout based on the WaterFlow container. Sections are used to implement hybrid layout, and functions such as tab ceiling, pull-down refresh, and unlimited loading are also implemented in this sample.

Phone

Travel Accommodation

This sample shows how to use the grid layout and List component to achieve responsive layouts of content for travel accommodation apps on different devices, such as smartphones, foldable screens, and tablets.

Phone

Smooth Homepage News Feeds

This sample guides news page developers in building a news home page from scratch, including common functions such as address selection, dynamic icons and smooth animations for switching between tabs and tab content, pull-down refresh and pull-up loading, and feed stream on the home page.

Phone

Navigation System Route

This sample provides system route verification. The system route table redirects to the page of a module (HSP/HAR), without the need to configure the dependency between different modules to jump. When a page is redirected, the page not redirected and loaded page will not be loaded. This resolves the dependency and coupling issues across different modules and the excessive loading time of the home page.

Phone

Text Effect Collection

This sample describes how to implement multiple text effects based on the Text component and common attributes.

Phone

Special Text Recognition

This sample describes how to use the enableDataDetector attribute of the Text component to recognize special characters.

Phone

PiP Effect

This sample demonstrates video playback, manual and automatic invocation of Picture-in-Picture (PiP), and video play and pause control in the PiP window. These features are implemented using interfaces provided by @kit.ArkUI and @kit.MediaKit.

Phone

Content Publisher

This sample uses the RichEditor component and common ArkUI component to implement an image and text content publisher.

Phone

Transition Animation Collection

This sample describes how to implement multiple common transition animations based on basic components, common attributes, and explicit animations.

Phone

Collection of Verification Code Scenarios

This sample describes five verification code scenarios: displaying the cursor in the text box, adding a horizontal bar at the bottom, changing the background color, selecting a verification code, and sliding a verification code.

Phone

Bottom Drawer Sliding Effect

This sample demonstrates the sliding effect of a bottom drawer, which is implemented using the List component. It also displays a page in immersive (full screen) mode and a dragging background map.

Phone

Custom Canvas

This sample demonstrates a custom canvas created with the Canvas component, featuring capabilities for selecting pen thickness, color, and opacity, as well as for drawing, zooming, and clearing.

Phone

Drag-and-Drop Framework Development

This sample shows how to create interactive UI elements that allow the user to drag and drop an image, rich text, a text box, and a list.

Phone

Dynamic Component Creation

This sample shows how to dynamically create a component in the declarative UI.

Phone

Smooth Page Slipping

This sample shows how to complex, smooth scrolling pages that ensure no frame drops during page transitions or scrolling.

Phone

Video Landscape/Portrait Mode Switching

This sample implements the function of automatically switching between landscape and portrait modes during video playback.

Phone

Launching the Atomic Service in an Embedded Manner

This sample shows how to use FullScreenLaunchComponent to launch the atomic service in an embedded manner.

Phone

Mobile Payment

Based on the default UI scanning capability and barcode image generation capability of Scan Kit, this sample implements the common scanning and acceptance and payment functions in mobile payment apps.

Phone

Grid-based Nested Hybrid Layout

This sample implements the nested hybrid layout of the Grid, List, and Swiper components.

Phone

List Item Exchange

This sample implements the functions of exchanging and deleting list items.

Phone

Short Video Supporting Multi-Device Deployment

This sample implements a short video app based on the adaptive layout and responsive layout, achieving one-time development for multi-device deployment.

Phone

Subwindow-based Floating Window

This sample shows how to use a subwindow to implement a floating window and use the PiP feature to implement a small video window.

Phone

Animation Collection

This sample demonstrates typical animation effects that are implemented based on basic components, universal attributes, and explicit animations.

Phone

Dark Mode

This sample calls APIs such as @ohos.app.ability.ConfigurationConstant to set the dark mode.

Phone

Short Video Switching

This sample demonstrates the switching of short videos based on the Swiper component.

Phone

Posting an Image Comment

This sample shows how to post a comment on an image by starting the system camera.

Phone

Convenient Life

Based on the adaptive layout and responsive layout, the sample implements the convenient life page that is developed once and deployed on multiple devices.

Phone

Multi-Image Carousel

The sample showcases a multi-image carousel feature using the Swiper component and a custom indicator.

Phone

Login and Logout

This sample uses the Navigation component for navigating between pages and PromptAction for popping up dialog boxes. It simulates the login and logout scenarios, and its UI code adapts to different device models. In addition, the app's login process complies with privacy requirements and features proper navigation logic.

Phone

Responsive Layouts for Stock Trading Apps Across Devices

This sample shows how to use the grid layout and List component to create responsive content layouts for stock trading apps across devices, such as smartphones, foldable screens, and tablets.

Phone

Responsive Layouts for Business Office Apps Across Devices

This sample shows how to use the breakpoint listening, sidebarContainer component, and navigation component to achieve responsive layouts of content for business office apps on different devices, such as smartphones, foldable screens, and tablets.

Phone

List Optimization

This sample demonstrates the use of ForEach for rendering a long list, and contrasts it with LazyForEach, which leverages caching of list items and component reuse, to optimize the performance of long list.

Phone

[h2]ArkWeb

Name

Overview

Device Type

Displaying Web Pages in an Instant Manner

This sample shows how to display the web pages in an instant manner by using pre-rendering.

Phone

Previewing PDF Files Using the Web Component

This sample shows how to use the Web component to preview local and online PDF files. The Tabs container component contains two independent TabContent subcomponents, which are used to preview local PDF files and online PDF files respectively.

Phone

Customizing the Touch and Hold Menu on the Web Page

This sample describes how to bind a custom menu to a tappable element (hyperlink or image) on the web page.

Phone

Jumping Between Webs and Applications

Based on the application startup capabilities, this sample implements scenarios such as jumping between the web page and ArkTS page, jumping to applications and details page in AppGallery from the web page.

Phone

JS Injection and Execution

Based on HTML5 games, this sample uses the ArkUI component <button> to implement basic game control.

Phone

HTML5 Page Redirection

This sample shows how to redirect between an HTML5 page and an ArkTS native page based on the ArkUI framework and web.

Phone

Web User Agent

This sample shows how to set and obtain the user agent using ArkTS and the Web component.

Phone

Obtaining Camera from Web Pages

This sample shows how to start the native camera on an HTML page to take a photo and obtain the returned photos.

Phone

Same-level Rendering of ArkWeb

This sample shows how to use the same-level rendering of ArkWeb. The native components of the system are directly rendered to the front-end HTML5 page.

Phone

[h2]Core File Kit

Name

Overview

Device Type

Selecting and View Documents and Media Files

This sample shows how to use the APIs provided by @ohos.file.picker, @ohos.file.photoAccessHelper and @ohos.file.fs to select and save documents, select and view photos in the system album, and select and play videos.

Phone

Large File Copy

File copy is a common scenario in application development. To copy files, you can either read and write all content of a file directly or use the buffer to read and write the file for multiple times. The former is easy to use, but the memory usage is high in large file copy scenarios, affecting application performance. The latter uses less memory usage, but the programming is more complex.

Phone

File Compression and Decompression in Different Paths

This sample shows how to use the interfaces provided by the third-party libraries @ohos.file.fs and @ohos/commons-compress to compress and decompress files in ZIP, GZIP, TAR, and 7Z formats in different paths.

Phone

System Storage Statistics

This sample shows how to use APIs for obtaining the storage information of an app and a file system.

Phone

[h2]Form Kit

Name

Overview

Device Type

Multi-Device Adaptive Service Widget

This sample shows the layout and usage of service widgets in a JS project. The widget content display is developed based on one-time development and multi-device deployment to implement multi-device adaptation.

Phone

ArkTS Widget Calculator

This sample shows how to develop a calculator model using the ArkTS widgets.

Phone

Gaming Widget

This sample shows how to develop a simple game widget based on the stage model.

Phone

Widget Update

This sample demonstrates how to use the router, call, and message events, as well as timed updates, to update widget information.

Phone

[h2]IME Kit

Name

Overview

Device Type

Custom Edit Box

This sample demonstrates how to use the input method framework to develop a custom edit box. You can bind an input method app, enter text through the app, and display or hide the input method.

Phone

[h2]Localization Kit

Name

Overview

Device Type

Internationalization

This sample shows how to use the APIs provided by the @ohos.i18n module to implement functions such as calendar display, character type recognition, and text breaking.

Phone

[h2]UI Design Kit

Name

Overview

Device Type

Icon processing

This sample illustrates how UI Design Kit can help you process both layered and single-layer icons, including combining the foreground and background images, and cropping, scaling, and stroking icons.

Phone, Tablet, PC/2in1, TV

Application Services

[h2]Account Kit

Name

Overview

Device Type

Account Kit Service

This sample code implements the following functions provided by Account Kit for HarmonyOS: signing in with the HUAWEI ID through just one tap, silently signing in, obtaining the avatar and nickname, obtaining the mobile number, obtaining the shipping address, making minor mode–related settings, and obtaining the invoice title.

Phone, Tablet, PC/2in1, TV

Account Kit Atomic Services

This sample project illustrates how to use the authentication.AuthenticationController API to implement silent sign-in, how to use the functions provided by the FunctionalButton component for obtaining the avatar, mobile phone, shipping address, and invoice title, and how to enable or disable the youth mode.

Phone, Tablet

[h2]Ads Kit

Name

Overview

Device Type

Ads Service

This sample demonstrates how to use APIs of Ads Kit to load and display ads in your apps.

Phone, Tablet

[h2]AppGallery Kit

Name

Overview

Device Type

AppGallery Kit

This sample demonstrates features such as displaying an app details page, adding an atomic service widget to the home screen, and loading HAPs on demand.

Phone, Tablet, PC/2in1

[h2]Call Service Kit

Name

Overview

Device Type

Social Communication - Call Service Kit (ArkTS)

This sample project illustrates how Call Service Kit works with Push Kit and Image Kit to implement functions such as subscribing to VoipCallUiEvent, reporting incoming audio and video calls, and reporting call status changes.

Phone

[h2]Cloud Foundation Kit

Name

Overview

Device Type

Cloud Foundation Kit (ArkTS)

This codelab will guide you through how to use Cloud Foundation Kit to interact with the cloud in your app.

Phone

[h2]Game Service Kit

Name

Overview

Device Type

Game Sign-In (ArkTS)

This sample demonstrates how to develop functions such as multi-provider sign-in, compliance verification, and player role information submission.

Phone, Tablet, PC/2in1, TV

Game Scene Perception

This sample introduces how your game sends data to the system and obtains device status through game scene perception.

Phone, Tablet, PC/2in1

Interaction Between the Game and the System Based on Scene Perception (C++)

This sample introduces how your game sends data to the system and obtains device status through game scene perception.

Phone, Tablet, PC/2in1

[h2]Health Service Kit

Name

Overview

Device Type

Health Service Kit(ArkTS)

Health Service Kit provides an open platform for Huawei ecosystem apps to access fitness and health data of users.

Phone, Tablet

[h2]IAP Kit

Name

Overview

Device Type

In-App Purchases(ArkTS)

Learn to use IAP Kit to build an app where users can buy consumables and that works with the IAP Kit's delivery acknowledgement API for repurchases.

Phone, Tablet, PC/2in1

[h2]Live View Kit

Name

Overview

Device Type

Bike Sharing

This sample implements functions such as QR code scanning, locating bikes on a map, and live view notification.

Phone

[h2]Map Kit

Name

Overview

Device Type

Map Kit - Map Display (ArkTS)

Map Kit is a powerful service within the HarmonyOS ecosystem. It empowers developers to effortlessly create customized map experiences by offering robust capabilities such as personalized map display, map search, and route planning. You can easily integrate map-related functions into HarmonyOS apps or atomic services to enhance user experience.

Phone, Tablet, PC/2in1, Wearable

Map Navigation

This sample describes how to use Map Kit to implement typical scenarios such as map viewing, location search, route planning, service widgets, and live caption across devices.

Phone

[h2]PDF Kit

Name

Overview

Device Type

PDFService (ArkTS)

PDF Kit is a PDF file service in the HarmonyOS ecosystem

Phone, Tablet, PC/2in1

[h2]Preview Kit

Name

Overview

Device Type

Data and Files - Preview Kit

This example shows how to use Preview Kit to preview files.

Phone, Tablet, PC/2in1

[h2]Scenario Fusion Kit

Name

Overview

Device Type

Retrieval of system attributes via API calls based on Scenario Fusion Kit

This sample code illustrates scenario-specific APIs provided by Scenario Fusion Kit, which can be used to obtain system information and location information.

Phone, Tablet, PC/2in1, Wearable, TV

Scenario-specific button components built based on Scenario Fusion Kit

This sample illustrates how to use scenario-specific APIs buttons provided by Scenario Fusion Kit, including quick mobile number verification, real-time mobile number verification, avatar selection, and authorization setting page display buttons.

Phone, Tablet, PC/2in1

Intelligent input suggestions and filling based on Scenario Fusion Kit

This sample code illustrates how to use SmartFill provided by Scenario Fusion Kit to offer scenario-specific input suggestions to realize one-tap filling of complex forms for users.

Phone, Tablet, PC/2in1

[h2]Share Kit

Name

Overview

Device Type

Social Communication - Share Kit (ArkTS)

This codelab describes how to use Share Kit to share data between apps.

Phone, Tablet, PC/2in1

[h2]Wallet Kit

Name

Overview

Device Type

Wallet Kit

Wallet Kit integrates the open capabilities of the end-to-end "chip-device-cloud" technology, providing digital passes such as car keys and transportation cards. Users can easily store these digital passes on their mobile phones for convenient use whenever needed. A user can enable a digital car key in HUAWEI Wallet to use their phone to unlock their car through Bluetooth, instead of using a physical key. A digital car key can be easily shared with others (such as family members). It will not be long before this technology is widely applied in the automotive industry of the Chinese mainland.

Phone

[h2]Location Kit

Name

Overview

Device Type

Location Service

This sample shows how to use the APIs provided by the geoLocationManager class of @kit.LocationKit.

Phone

[h2]Notification Kit

Name

Overview

Device Type

Custom Notification Badge

This sample shows how to use the @ohos.notificationManager APIs to set a badge on the home screen and send and obtain notifications.

Phone

Subscribing to and Publishing Common Events

This sample shows the features related to common events for monitoring some user operations.

Phone

[h2]Telephony Kit

Name

Overview

Device Type

Event Subscription

This sample shows how to use the APIs provided by @ohos.telephony.observer to subscribe to events such as the network status, signal status, cellular data, and SIM card status and obtain the status change result.

Phone

Media

[h2]Audio Kit

Name

Overview

Device Type

AVCodec Based Video Codec

This sample demonstrates video playback and recording implemented on AVCodec.

Phone

Audio Playback Control Based on AudioRenderer

This sample demonstrates an audio app that implements audio playback control based on AudioRenderer.

Phone

Low-Latency Audio Recording and Playback

This sample demonstrates functions related to low-latency audio recording and playback.

Phone

[h2]AVCodec Kit

Name

Overview

Device Type

AVCodec Based Video Codec

This sample demonstrates video playback and recording implemented on AVCodec.

Phone

[h2]AVSession Kit

Name

Overview

Device Type

AVSession Provider

This sample demonstrates an app that functions as an AVSession provider. It uses @ohos.multimedia.avsession to implement custom information exchange between the provider and Media Controller.

Phone

Call Device Switching

This sample uses the AVCastPicker component to implement the function of switching audio output devices during a call and uses the customPicker parameter to customize icons for audio output devices.

Phone

[h2]Camera Kit

Name

Overview

Device Type

Starting the System Camera

This sample shows how to start the system camera to take a photo and return it to the app.

Phone

Collecting and Saving Camera Data

This sample demonstrates the preview and photographing functions of a camera app.

Phone

Video Recording Using Camera Kit and AVRecorder

This sample demonstrates the use of Camera Kit to customize a camera and use the camera to record videos through AVRecorder. This sample demonstrates a custom camera through Camera Kit and records video with AVRecorder.

Phone

[h2]Image Kit

Name

Overview

Device Type

Puzzle Game

This sample uses the @ohos.multimedia.image and @ohos.file.photoAccessHelper APIs to obtain and crop an image.

Phone

Image Compression

This sample uses the interfaces provided by @ohos.multimedia.image to compress images using the binary reduction method.

Phone

Adaptive Background Color Based on the Icon

This sample describes how to set an adaptive background color based on the icon main color.

Phone

Converting the Background Color in Line with the Theme using colorPicker

This sample describes how to use the image library and colorPicker in the EffectKit library to pick the color of the target image, use the obtained color as the background gradient color, and use the Swiper component to rotate images.

Phone

PixelMap Deep Copy

The deep copy of PixelMap is often involved in image development. In this sample, the readPixelsToBuffer method of PixelMap is used to implement the deep copy.

Phone

Handwritten Drawing and Saving Images

This sample uses Pen and Path of the Drawing module in conjunction with the NodeContainer component to implement the handwritten drawing feature.

Phone

Adding Watermarks

This sample describes how to add watermarks to the page background during photo saving and photo shooting.

Phone

[h2]Media Kit

Name

Overview

Device Type

Video Playback

The core function of video playback is to convert video data into visible signals, play the signals through output devices, and manage the playback process. This document outlines the development for scenarios such as full-process video playback, video switching, and looping.

Phone

Collecting and Saving Camera Data

This sample shows how to use the libohcamera.so interface to implement a series of camera functions, including preview, photographing, recording, switching between front and rear cameras, as well as focus and exposure control.

Phone

Playing While Caching

This sample demonstrates the feature of playing a video while caching it.

Phone

[h2]Ringtone Kit

Name

Overview

Device Type

Ringtone service

Based on Ringtone Kit (ringtone service), it provides the function of setting ringtones.

Phone, Tablet

[h2]Scan Kit

Name

Overview

Device Type

Scan Kit

This sample code demonstrates how to integrate "scan-to-access" to redirect users to a specific in-app service page in just one step and use Scan Kit's functions of recognizing, scanning, and generating barcodes, including image-based barcode recognition, barcode scan by default UI, barcode scan by custom UI, and barcode image generation.

Phone, Tablet

System

[h2]Basic Services Kit

Name

Overview

Device Type

Zip and Unzip

This sample uses the interfaces provided by @ohos.zlib and @ohos.fileio to add, zip, and unzip files.

Phone

Network Upload and Download

This sample shows how to use the APIs provided by @ohos.request to create upload and download tasks. The HTTP File Server (HFS) acts as the server to upload and download files and query tasks.

Phone

Device Management Collection (Non-system Feature)

This sample shows the basic device management (non-system feature) modules that do not require complex functionality display.

Phone

App Account Management

This sample shows how to register an account, log in to an app using the registered account, and set account information.

Phone

Pako Compression and Decompression

This sample demonstrates the compression and decompression features. It compresses a string into a file. It also decompresses the file to read and display the string.

Phone

Pasteboard

This sample uses the PasteButton component and the interfaces provided by @ohos.pasteboard to implement the basic copy and paste functions of the pasteboard.

Phone

[h2]Car Kit

Name

Overview

Device Type

Car Kit (ArkTs)

This sample code illustrates how to use APIs of the navigation information service and mobility distributed engine service.

Phone

[h2]Connectivity Kit

Name

Overview

Device Type

WLAN Information Query

This sample shows how to use the APIs provided by wifiManager to obtain WLAN information.

Phone

[h2]Crypto Architecture Kit

Name

Overview

Device Type

Cipher

This sample shows how to use the APIs provided by the Cipher object of cryptoFramework to implement encryption and decryption using the RSA and AES algorithms.

Phone

[h2]Device Certificate Kit

Name

Overview

Device Type

Certificate Framework

This sample shows how to use the APIs provided by the @ohos.security.cert module to verify signature data.

Phone

[h2]Device Security Kit

Name

Overview

Device Type

Business RiskIntelligent Detection

Provides business risk intelligent detection for anti-cheating, anti-fraud, and violation check.

Phone, Tablet

Security - DeviceVerify (ArkTS)

This sample code illustrates how to obtain a device token in an app to check the status of the app on the device.

Phone, Tablet, PC/2in1, Wearable, TV

SafetyDetect Service

This sample code illustrates how to obtain the system integrity check and URL check results in an app.

Phone, Tablet, PC/2in1

Security - TrustedAppService (ArkTS)

Provides the TrustedAppService function to implement image security verification and location security verification, preventing images or location data obtained by apps from being tampered with.

Phone, Tablet, PC/2in1

[h2]Distributed Service Kit

Name

Overview

Device Type

App Continuation

A distributed video player with a live video playback interface is developed in ArkTS.

Phone

[h2]Enterprise Data Guard Kit

Name

Overview

Device Type

Security-Enterprise Data Guard Kit

This codelab illustrates how to implement functions for scanning files in the media library directory and app sandbox directory through Enterprise Data Guard Kit.

PC/2in1

[h2]Network Kit

Name

Overview

Device Type

HTTP

This sample shows how to use the APIs provided by @ohos.net.http to initiate an HTTP request based on the URL and related configuration.

Phone

Network Management

This sample shows how to query network details, resolve domain names, and listen for network status.

Phone

Cross-Process Communication by Listening to 127.0.0.1 Through Socket

This sample showcases cross-process communication by listening to 127.0.0.1 through socket.

Phone

Network Performance Analysis

This sample shows how to use PerformanceTiming() to obtain detailed timing information about each phase in an HTTP data request process in a table.

Phone

Downloading Multiple Files

This sample shows how to use the APIs provided by the request module to listen for and manage the download progress and status of multiple files.

Phone

Remote Communication Platform

Remote communication platform (RCP) provides network data request functionalities.

Phone

[h2]Network Boost Kit

Name

Overview

Device Type

Network Boost Kit

Offers a solution that enhances network performance through acceleration, awareness, and prediction capabilities. By coordinating software, hardware, chips, devices, pipes, and cloud resources, it optimizes network resource allocation for a more reliable, smoother, and faster Internet experience.

Phone, Tablet

[h2]Online Authentication Kit

Name

Overview

Device Type

Security-Online Identity Verification-FIDO(ArkTS)

This codelab describes how to use the FIDO password-free identity verification capability provided by HarmonyOS.

Phone, Tablet, PC/2in1

Security-Online Identity Verification-IFAA(ArkTS)

This codelab describes how to use the IFAA password-free identity verification capability provided by HarmonyOS.

Phone, Tablet, PC/2in1

Security-Online Identity Verification-SOTER(ArkTS)

This codelab describes how to use the SOTER password-free identity verification capability provided by HarmonyOS.

Phone, Tablet, PC/2in1

[h2]Pen Kit

Name

Overview

Device Type

Pen kit

This example shows how to use the Pen Kit capability to implement the application integrated handwriting function.

Phone, Tablet, PC/2in1

[h2]Performance Analysis Kit

Name

Overview

Device Type

Printing Logs

This sample shows how to use the loggers of the HiLog system so that your app or service can output logs based on the specified level, ID, and string format, helping you understand the running status of your app or service and better debug it.

Phone

App Exception Handling

This sample shows how to use hiAppEvent to obtain the last app exception information, which can be app crash or suspension.

Phone

Debug

This sample shows how to use the @ohos.hidebug API to obtain the memory usage of an application.

Phone

[h2]Remote Communication Kit

Name

Overview

Device Type

Network-RemoteCommunication(ArkTS)

Remote Communication Kit is a network request service in the HarmonyOS ecosystem.

It provides convenient network request capabilities for you to customize network request functions.

You can easily integrate functions related to network requests into HarmonyOS apps to improve user experience.

Phone

[h2]Service Collaboration Kit

Name

Overview

Device Type

Service Collaboration Kit

Service Collaboration Kit provides the capability of multi-device collaboration based on the same account.

Phone, Tablet, PC/2in1

[h2]Status Bar Extension Kit

Name

Overview

Device Type

Status Bar Extension Kit (ArkTS)

This codelab enables apps to add its icon to the status bar based on Status Bar Extension Kit.

PC/2in1

[h2]Test Kit

Name

Overview

Device Type

Test Framework

This sample shows how to use the unit test framework. The code component repository arkXtest of the automatic test framework is used. If log printing and debugging are required, the log printing API @ohos.hilog needs to be introduced.

Phone

Test Framework

This sample shows how to use the unit test framework. The UiTest API @ohos.UiTest has to be introduced.

Phone

[h2]User Authentication Kit

Name

Overview

Device Type

User Authentication

This sample shows how to perform facial authentication and fingerprint authentication, use the password vault for automatic password filling, and prevent screen capture or recording in the app UIs involving password input.

Phone

[h2]Wear Engine Kit

Name

Overview

Device Type

Wear Engine Kit

This sample shows how to use Wear Engine to obtain the list of connected wearable devices and interact with the wearable app.

Phone, Tablet

[h2]NDK

Name

Overview

Device Type

OpenGL Tetrahedron

This sample, based on the Native C++ template, uses OpenGL (OpenGL ES) API calls to draw a 3D shape (tetrahedron) and render it on the XComponent of the page.

Phone, Tablet

Using dlopen to Load a .so Library and Obtain Raw Files

This sample shows how to use dlopen to load a .so library within a TaskPool thread and how to use the native Rawfile APIs to manipulate the rawfile directory and files in the directory.

Phone

Native XComponent

This sample shows how to use the native XComponent interface to obtain a NativeWindow instance, obtain the layout/event information, register an event callback, draw shapes on the page through OpenGL/EGL, and render YUV images.

Phone

Basic Data Type Conversion

This sample shows how to use DevEco Studio to create a native C++ app, pass ArkTS data (of basic data types) to native for processing, and return the result to ArkTS.

Phone

Native Multithreading

This sample uses the producer-consumer pattern to illustrate the development of native multithreading and inter-thread communication.

Phone

XComponent Double Buffering

This sample shows how to use the Drawing module to create a bitmap, which is subsequently rendered onto the XComponent using double buffering via NativeWindow.

Phone

Implementing Progress Notification on the Native Side

This example demonstrates how to pass native progress information to ArkTS in a download scenario.

Phone

Saving Images to the App Sandbox in Native Mode

This sample describes how to save images on the network and those in the rawfile to the application sandbox in native mode.

Phone

Customize Animations with XComponent and Vsync

This sample describes how to customize animations by using XComponent and Vsync events.

Phone

AI

[h2]Core Vision Kit

Name

Overview

Device Type

Core Vision Kit-Optical Character Recognition

This example shows the ability to convert image information to character information.

Phone, Tablet, PC/2in1

Core Vision Kit-Face Detection

This example shows the AI capability of detecting faces in images and returning various data.

Phone, Tablet, PC/2in1

Core Vision Kit-Subject Segmentation

This example shows the AI capability of identifying and extracting subjects in images, helping developers detect foreground objects and separate foreground subjects.

Phone, Tablet, PC/2in1

Core Vision Kit-Face Verification

This example shows the AI capability of comparing faces in two images and determining whether the faces are the same person.

Phone, Tablet, PC/2in1

Core Vision Kit-Multi-object Detection

This example demonstrates the AI capability of identifying prominent target objects in an image.

Phone, Tablet, PC/2in1

Core Vision Kit-Skeleton Detection

This example demonstrates the AI capability to recognize key bone points in a portrait.

Phone, Tablet, PC/2in1

Photo Text Recognition

This sample shows how to use the APIs provided by @ohos.multimedia.camera (camera management) and textRecognition (text recognition) to recognize and extract text in images.

Phone

[h2]Core Speech Kit

Name

Overview

Device Type

CoreSpeechKit-TextToSpeech

This example shows the AI capability of converting text information into voice and playing it.

Phone, Tablet, PC/2in1

CoreSpeechKit-Speech Recognition

This example shows the AI capability of converting audio information into text.

Phone, Tablet, PC/2in1

[h2]Intents Kit

Name

Overview

Device Type

Intents Kit

Intents Kit for HarmonyOS defines standards for intents, linking functions of apps or atomic services.

It helps you intelligently distribute functions of apps or atomic services to system access points. This process is called smart distribution. The system access points include Celia Chat, Celia Search, and Celia Suggestions.The following figure shows the relationships among system access points, Intents Kit, and the HarmonyOS ecosystem.

Phone, Tablet

[h2]CANN Kit

Name

Overview

Device Type

Image Classification Based on SqueezeNet

This sample demonstrates the AI capabilities of CANN Kit and shows how to run AI models for image classification.

Phone, Tablet, PC/2in1, TV

[h2]MindSpore Lite Kit

Name

Overview

Device Type

Classifying Images Using MindSporeLite

This sample shows how to use the ArkTS APIs provided by MindSporeLite to build an app for classifying images on a device.

Phone

[h2]Natural Language Kit

Name

Overview

Device Type

Machine Learning - Natural Language Kit

Natural Language Kit provides multiple basic capabilities related to text semantic understanding, helping you better process and analyze text data.

Phone, Tablet, PC/2in1

[h2]Speech Kit

Name

Overview

Device Type

Speech Kit-AI Caption

Based on the scenario-based voice capability, AI models are provided to read text content aloud.

Phone, Tablet, PC/2in1

Speech Kit-TextReader

Based on the scenario-based voice service capability, this example provides the service of identifying audio files as texts.

Phone, Tablet, PC/2in1

[h2]Vision Kit

Name

Overview

Device Type

VisionKit-InteractiveLiveness

In this example, the liveness detection and silent liveness detection are used to verify whether a user is a real live person.

Phone, Tablet

VisionKit-CardRecognition

This example shows the multi-certificate structured identification service.

Phone, Tablet

VisionKit-DocumentScanning

In this example, the provides the service of taking documents and converting them to HD scanned copies.

Phone, Tablet

Graphics

[h2]AR Engine

Name

Overview

Device Type

AR Engine

This example displays the recognized point cloud information, plane information, etc. on the screen by calling the AR engine service interface and combining XComponent and OpenGL/EGL.

Phone, Tablet

[h2]ArkGraphics 2D

Name

Overview

Device Type

Smooth Page Refreshing

This sample describes how to smoothly refresh a page.

Phone

[h2]ArkGraphics 3D

Name

Overview

Device Type

3D Engine APIs

This sample demonstrates the APIs in @ohos.graphics.scene, one of the 3D engine modules. Images rendered by the 3D engine are displayed in the Component3D component.

Phone

[h2]Graphics Accelerate Kit

Name

Overview

Device Type

Graphics Accelerate Kit - Frame Generation Example of OpenGL ES (C++)

The frame generation capability is provided in graphics rendering scenes based on frame generation APIs offered by Graphics Accelerate Kit.

Phone, Tablet

Graphics Accelerate Kit - Frame Generation Example of Vulkan (C++)

The frame generation capability is provided in graphics rendering scenes based on APIs offered by Graphics Accelerate Kit using Vulkan.

Phone, Tablet

Graphics Accelerate Kit - ABR Example (C++)

The adaptive buffer resolution (ABR) capability is provided in graphics rendering scenes based on ABR APIs offered by Graphics Accelerate Kit.

Phone, Tablet

Graphics Accelerate Kit - OpenGTX Example (C++)

This sample code illustrates how to implement the OpenGTX capability in graphics rendering scenes based on the OpenGTX APIs provided by Graphics Accelerate Kit.

Phone, Tablet

[h2]XEngine Kit

Name

Overview

Device Type

XEngine Kit – GLES

This sample shows how to use the APIs provided by XEngine Kit to perform image upscaling and adaptative VRS.

Phone, Tablet, PC/2in1, TV

XEngine Kit – Vulkan

This sample shows how to use the APIs provided by XEngine Kit to perform image upscaling and adaptative VRS.

Phone, Tablet, PC/2in1, TV

XEngine Kit – Subpass Shading

This sample shows how to reduce DDR bandwidth using the Subpass Shading feature.

Phone, Tablet, PC/2in1, TV