OpenIM SDK for uni-app / uni-app x
Integrate OpenIMClientSDK into Android, iOS, and HarmonyOS apps built with uni-app and uni-app x.
The OpenIM uni-app / uni-app x SDK is delivered as a UTS native plugin that exposes OpenIMClientSDK capabilities to both standard uni-app (Vue 2 / Vue 3) and uni-app x projects. The SDK provides native client features across Android, iOS, and HarmonyOS apps, covering user identity, relationships, conversations, groups, messaging, audio/video call signaling, real-time events, and local SQLite data persistence.
Applicable scenarios
Use this SDK when developing multi-platform native mobile applications in HBuilderX and requiring full-featured instant messaging within uni-app (Vue 2 / Vue 3) or uni-app x. The plugin wraps underlying native SDKs directly, providing client capabilities including SQLite database storage, conversation caching, and offline message synchronization.
This SDK does not support Web browsers or Mini Programs. For Web applications, refer to the OpenIM WASM SDK Overview. For Mini Programs and lightweight Web scenarios without local SQLite message storage, refer to the OpenIM Mini Program SDK Overview.
Supported platforms
| Project type and platform | Support status | Minimum OS version |
|---|---|---|
| uni-app App Android (Vue 2 / Vue 3) | Supported | Android 5.0 / API 21 |
| uni-app App iOS (Vue 2 / Vue 3) | Supported | iOS 14 |
| uni-app App HarmonyOS (Vue 2 / Vue 3) | Commercial license required | HarmonyOS API 24 |
| uni-app x App Android | Supported | Android 5.0 / API 21 |
| uni-app x App iOS | Supported | iOS 14 |
| uni-app x App HarmonyOS | Commercial license required | HarmonyOS API 24 |
| Web / Mini Programs | Not supported | — |
HarmonyOS platform availability and commercial capabilities depend on the delivered SDK package and licensing agreement. When accessing photos, the camera, microphone, or local files, declare and request the appropriate system permissions within the host app manifest and runtime flow.
Integration workflow
The SDK is delivered in the uni_modules/unix-openim-sdk directory. Place this folder into your project root and import API functions directly from the plugin package:
import {
initSDK,
login,
createTextMessage,
sendMessage,
} from '@/uni_modules/unix-openim-sdk'Native dependencies are not included in the standard HBuilderX run base. Before debugging SDK initialization, user authentication, messaging, or event listeners, build and run a custom debugging base containing this plugin, or compile a formal native application package.
Conventions and usage guidelines
- Promises: Methods return Promises for business results. When an operation fails, the Promise rejects with an error containing
errCodeanderrMsg. - Event subscriptions: Event registration methods prefixed with
onreturn anOpenIMSDKEventSubscription. Calloff(subscription)with that reference when unmounting components, logging out, or resetting the SDK lifecycle. - Query snapshot vs. real-time sync: Query methods retrieve point-in-time local snapshots, whereas real-time event listeners stream incremental updates. A successful Promise indicates the local request completed; cross-device state propagation occurs through subsequent events.
- File paths: File and media operations accept either POSIX absolute paths readable by the app sandbox or
unifile://URI paths generated fromuni.env.USER_DATA_PATH.
Next steps
- Read Before you start to set up OpenIMServer, prepare test credentials, and configure your native build environment.
- Follow Integrate by project and platform to install the plugin and configure platform settings for Android, iOS, and HarmonyOS.
- Review Authenticate and manage a session to register connection listeners, initialize the SDK, and log in.
- Follow Send your first message to verify one-on-one and group messaging flows.
Subsequent documentation is organized across user profiles, relationships, conversations, groups, messaging, file uploads, audio/video call signaling, and events, strictly adhering to public UTS types and methods exported by the uni-app / uni-app x plugin.
Was this page helpful?