hmos-multidevice-hardware-access

Generate HarmonyOS hardware adaptation plans for camera, sensor, and external device access.

31|6|Updated Jan 29, 2026
One-click install
npx skills add https://github.com/openharmonyinsight/openharmony-skills --skill hmos-multidevice-hardware-access
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hmos-multidevice-hardware-access
Source: https://github.com/openharmonyinsight/openharmony-skills/tree/main/skills/harmonyos-ai-agent-skill/references/hmos-multidevice-hardware-access
Command: npx skills add https://github.com/openharmonyinsight/openharmony-skills --skill hmos-multidevice-hardware-access

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill solves the problem of HarmonyOS apps crashing or behaving incorrectly across devices when hardware capabilities differ, especially for camera, sensors, and external device access.

Core Features & Use Cases

  • Declarative hardware-adaptation planning: produces a structured plan covering primary scene routing, device constraints, and explicit non-support degradation behavior.
  • Camera adaptation for multi-device & foldable behaviors: handles camera enumeration, foldStatus-driven camera re-initialization, preview/capture/rotation correctness, and stride-safe frame processing to prevent black screens and visual artifacts.
  • Sensor and external device lifecycle correctness: ensures canIUse + SysCap/module.json5 checks, subscription/unsubscription lifecycles, and reconnect/heat-plug state refresh strategies.
  • Use case: A foldable-camera app shows a black preview after fold/expand and photos rotate incorrectly; use this skill to generate a fix plan that links capability checks (HW-01) with camera rebuild and rotation validation (HW-02).

Quick Start

Use the hmos-multidevice-hardware-access skill to produce a device-conditional adaptation plan and a verification matrix for your camera/sensor/external-device scenario.

Frequently Asked Questions about hmos-multidevice-hardware-access

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

FAQPage Schema
How do I handle HarmonyOS camera preview black screens and incorrect rotation on foldable devices?

To fix foldable camera black screens and rotation issues, implement foldStatus-driven camera re-initialization and validate preview/capture rotation correctness. This ensures the preview rebuilds correctly and photos rotate properly after fold/expand transitions.

What is the best way to check HarmonyOS hardware capabilities before accessing sensors?

The best way to check hardware capabilities is using canIUse with SysCap and module.json5 checks before sensor access. This pre-checking guardrail ensures your app explicitly degrades behavior on devices lacking specific hardware support.

How do I manage sensor lifecycle subscribe and unsubscribe logic for external device heat-plug events?

To manage sensor lifecycle for heat-plug events, implement lifecycle-safe subscribe and unsubscribe logic paired with reconnect and heat-plug state refresh strategies. This guarantees connection states are refreshed accurately when external devices are attached or removed.

Does stride-safe frame processing prevent visual artifacts in multi-device camera applications?

Yes, stride-safe frame processing prevents visual artifacts and black screens in multi-device camera applications. It handles stride differences across device camera hardware to ensure frames are processed correctly without distortion.

How do I implement fallback strategies for unsupported hardware features in HarmonyOS?

To implement fallback strategies for unsupported hardware, generate a declarative hardware-adaptation plan covering primary scene routing, device constraints, and explicit non-support degradation behavior. This routes users to alternative functional paths when hardware is unavailable.