UniApp App (Android / iOS) demo
sdk/uniapp/demo-app in the repository is a complete IM example for UniApp Apps (App-Plus, Android and iOS). It uses @deeprespond/im-uniapp/app with the native plugins in uni_modules (native bridges for IM and RTC, device push, and the system call screen). The same code also compiles to H5 for debugging and automated testing in the browser; App-only features are hidden automatically in H5 or show that they're unavailable.
What it covers
| Area | Covers |
|---|---|
| Account | Password sign-in and sign-up, automatic sign-in restore, temporarily changing the server address, logs |
| Conversations | Unread badges, pinning, marking unread, drafts, typing indicators, search, clearing history, unread badge on the tabBar |
| Messages | Text, emoji, images, video, files, voice, location; recall, reactions, forwarding, resending; automatic read marking |
| Friends | Sending, accepting and declining friend requests, remarks, blocklist, removing; contact search |
| Group chat | Starting group chats, inviting and removing members, renaming, leaving, dissolving, system notices in the group |
| Audio and video | One-to-one calls (incoming call overlay; answer, hang up, mute, camera on and off); an RTC channel page (with native and H5 rendering) |
| App only | Device push registration, the system call screen (iOS CallKit, Android Telecom), the native video component dr-rtc-video |
Run on devices or simulators (main path)
- Copy
.env.exampleto.env.localand fill in the publicappKeyandapiUrl; never put server secrets there. - Open
sdk/uniapp/demo-appin HBuilderX, install theuni_modulesdependencies, and run it on an Android or iOS device or simulator (the UTS plugins compile automatically). - In
manifest.jsonand the native plugins' config, fill in the package name, push certificates (FCM, Huawei, Honor, Xiaomi, OPPO, vivo, Meizu), CallKit and Telecom permissions, and the RTC service address. - First check that sign-in and messaging work under "Messages" and "Contacts", then check media permissions and video rendering on the "RTC channel" page.
Offline packages of the UTS native plugins are available from UniApp SDK integration and downloads.
Run in the browser (H5 debugging and automated tests)
cd sdk/uniapp/demo-app
cp .env.example .env.local
# 编辑 .env.local;不要提交真实密码、Ticket 或长期密钥。
pnpm install
pnpm dev:h5 # http://127.0.0.1:5187Vite's dev proxy forwards /client (including WebSocket) to the IM service (default IM_HARNESS_URL=http://127.0.0.1:18480), and /im-private and /im-public (signed file download addresses) to S3-compatible storage (default IM_S3_URL=http://127.0.0.1:9010).
Environment variables
| Variable | Description |
|---|---|
VITE_IM_APP_KEY | The app's App Key; default org#app |
VITE_IM_API_URL | IM service address; for H5 debugging, the local service is enough (forwarded by the dev proxy) |
VITE_IM_WS_URL | WebSocket address, optional |
Conditional compilation and fallbacks
The project separates platforms with #ifdef APP-PLUS and #ifdef H5 (the native bridge is in core/native.js, client creation in core/client.js):
- App: push registration, the system call screen (Telecom, CallKit) and native video rendering with
dr-rtc-videoare available. - H5: page logic and SDK calls are shared with the App. Push registration is compiled out, the system call screen isn't shown, and call and channel media use the browser's WebRTC (LiveKit). Recording, location and file picking depend on the browser; when unavailable, the UI shows the SDK's failure reason.
Testing scope and source package
The H5 target can run three-account end-to-end tests with Playwright on Linux or CI, and the native bridges can be checked statically. Android and iOS builds, and features such as push, the system call screen and native video rendering, need the right development machines and real devices to test.
Demo source package (1.0.1, without dependencies or local config): deeprespond-uniapp-demo-app-1.0.1.zip
