This project provides an OpenHarmony platform adapter for Ionic Capacitor, allowing developers to run Ionic and web applications on OpenHarmony devices and emulators.
Capacitor OpenHarmony brings the cross-platform power of Capacitor to the OpenHarmony ecosystem. It provides a native container using the ArkUI Web component and a bridge that implements Capacitor's plugin semantics, enabling seamless communication between web code and native OpenHarmony APIs.
capacitor-openharmony/: The core platform adapter package (@oniroproject/capacitor-openharmony).plugins/: OpenHarmony-specific implementations of Capacitor core plugins (e.g., Device, Filesystem, Preferences) under the@oniroprojectscope.ionic-openharmony-demo/: A sample Ionic React application configured for OpenHarmony.docs/: Technical plans, status reports, and architecture documentation.
To run an Ionic application using this plugin, follow these steps (illustrated using the provided demo app):
- DevEco Studio: Install the latest version of DevEco Studio.
- OpenHarmony SDK: Ensure you have the OpenHarmony SDK configured in DevEco Studio.
- Node.js: Version 20.x or later.
Navigate to your Ionic project (e.g., ionic-openharmony-demo) and install dependencies:
cd ionic-openharmony-demo
npm installBuild your web project:
npm run buildIf you haven't already, add the OpenHarmony platform to your Capacitor project:
npx cap add openharmonySync your web assets and Capacitor plugins to the native OpenHarmony project:
npx cap sync openharmonyOpenHarmony applications require a signature to run on physical devices and some emulators.
- Open the
openharmonyfolder within your project in DevEco Studio. - Navigate to File > Project Structure > Project > Signing Configs.
- Click Automatically generate signature (requires a login with a Huawei ID).
You can run the application directly from DevEco Studio or use the provided helper script if you have a device connected via hdc:
./run-ohos-app.shThe Capacitor CLI is extended with OpenHarmony support:
npx cap add openharmony: Initialize the native OpenHarmony project.npx cap sync openharmony: Copy web assets and sync plugin dependencies.npx cap open openharmony: Launch the project in DevEco Studio.
For more detailed information, please refer to the docs directory: