hmos-scan-kit-customscan

Integrates Huawei Scan Kit custom camera scanning UI into HarmonyOS ArkTS projects.

2|Updated Jun 21, 2026
One-click install
npx skills add https://github.com/IsKenKenYa/skills --skill hmos-scan-kit-customscan-iskenkenya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hmos-scan-kit-customscan
Source: https://github.com/IsKenKenYa/skills/tree/main/skills/harmonyos/development/media/scan-kit/hmos-scan-kit-customscan
Command: npx skills add https://github.com/IsKenKenYa/skills --skill hmos-scan-kit-customscan-iskenkenya

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Integrating Huawei Scan Kit's custom-scan capability into a HarmonyOS app requires many coordinated steps: copying sample code, merging resources, declaring CAMERA permission, registering routes, and wiring the XComponent camera preview. This Skill automates that entire integration through a guided 5-phase workflow. ## Core Features & Use Cases - Guided 5-Phase Integration: Project inspection, file copy/merge via subagents, page implementation, permission and route configuration, and code verification. - Full Custom Scan UI: Camera preview stream via XComponent, flashlight control, zoom, focus point setting, and multi-code recognition based on official sample code. - Smart Merging: Incrementally merges tool classes and resource files (string.json, float.json, color.json) into existing projects without deleting original content. - Use Case: A developer with an existing HarmonyOS app wants a fully customized barcode/QR scanning page with flash and zoom controls instead of the default scan UI; the Skill copies the sample implementation, configures permissions, and verifies compilation. ## Quick Start Add a custom Scan Kit scanning page with flashlight and zoom controls to my HarmonyOS project and wire it to my existing scan entry button.

Frequently Asked Questions about hmos-scan-kit-customscan

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a custom scan UI with Huawei Scan Kit in HarmonyOS?

Use the customScan module from @kit.ScanKit: call init with ScanOptions, then start with a ViewControl containing the XComponent surfaceId, width, and height. Handle results in the callback, then call stop and release when the page hides.

How to control flashlight and zoom in HarmonyOS custom scanning?

After calling customScan.start, use getFlashLightStatus, openFlashLight, and closeFlashLight for flash control, and setZoom/getZoom for zoom ratios. These APIs only work between start and stop, otherwise error 1000500001 is thrown.

What permissions does HarmonyOS custom barcode scanning require?

Custom scanning requires ohos.permission.CAMERA declared in module.json5 with a reason string and usedScene, plus runtime user authorization via requestPermissionsFromUser. Without it, init returns error 201 on newer versions.

Why does customScan return error 1000500001 in HarmonyOS?

Error 1000500001 is an internal error usually caused by wrong API call order, such as calling start before init or flash APIs before start. Follow the init, start, stop, release sequence and check device capability with canIUse first.

Does HarmonyOS custom scan work on all devices?

No. Check support with canIUse('SystemCapability.Multimedia.Scan.ScanBarcode') or scanCore.isCustomScanSupported before launching. From version 6.1.0(23) it supports Wearables with rear cameras, but devices without rear cameras fail.