- Remove docs/server/websocket.md and sidebar entry - Server API: remove Update 服务 section (only IM + Push) - Go/Python/Java SDK docs: remove Update from intro and capability tables - RN license: remove manual initialize(baseUrl) section - Flutter license: remove manual initialize(baseUrl) section - Flutter/Harmony: fix git URLs to xuqmGroup org - Harmony: add LicenseSDK to modules table and create harmony/license.md Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
107 行
1.5 KiB
Markdown
107 行
1.5 KiB
Markdown
# HarmonyOS 安装配置
|
||
|
||
**包名**:`@xuqm/harmony-sdk` · **版本**:0.1.0 · **语言**:ArkTS
|
||
|
||
---
|
||
|
||
## ohpm 安装
|
||
|
||
在 HarmonyOS 项目的 `oh-package.json5` 中添加:
|
||
|
||
```json5
|
||
{
|
||
"dependencies": {
|
||
"@xuqm/harmony-sdk": "^0.1.0"
|
||
}
|
||
}
|
||
```
|
||
|
||
然后执行:
|
||
|
||
```bash
|
||
ohpm install
|
||
```
|
||
|
||
> 发布仓库:`https://ohpm.openharmony.cn/ohpm/`
|
||
|
||
---
|
||
|
||
## 最低 API 版本
|
||
|
||
- API 12+(HarmonyOS 4.0+)
|
||
- DevEco Studio 4.0 Release 或更高版本
|
||
|
||
---
|
||
|
||
## 权限配置
|
||
|
||
在 `module.json5` 中声明所需权限:
|
||
|
||
```json5
|
||
{
|
||
"module": {
|
||
"requestPermissions": [
|
||
{
|
||
"name": "ohos.permission.INTERNET"
|
||
},
|
||
{
|
||
"name": "ohos.permission.GET_NETWORK_INFO"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
```
|
||
|
||
如需使用相机、相册、麦克风等功能,额外添加:
|
||
|
||
```json5
|
||
{
|
||
"module": {
|
||
"requestPermissions": [
|
||
{
|
||
"name": "ohos.permission.CAMERA"
|
||
},
|
||
{
|
||
"name": "ohos.permission.READ_MEDIA"
|
||
},
|
||
{
|
||
"name": "ohos.permission.WRITE_MEDIA"
|
||
},
|
||
{
|
||
"name": "ohos.permission.MICROPHONE"
|
||
}
|
||
]
|
||
}
|
||
}
|
||
```
|
||
|
||
---
|
||
|
||
## 初始化
|
||
|
||
```ts
|
||
import { XuqmSDK } from '@xuqm/harmony-sdk'
|
||
import common from '@ohos.app.ability.common'
|
||
|
||
// 在 EntryAbility.onCreate 或页面初始化时
|
||
const context = getContext(this) as common.UIAbilityContext
|
||
await XuqmSDK.init(context, {
|
||
appKey: 'your_app_key',
|
||
})
|
||
```
|
||
|
||
---
|
||
|
||
## 登录
|
||
|
||
```ts
|
||
const session = await XuqmSDK.login('user_001', 'your_user_sig_jwt')
|
||
```
|
||
|
||
---
|
||
|
||
## 下一步
|
||
|
||
- [HarmonyOS IM 接入 →](./im)
|
||
- [HarmonyOS 授权管理 →](./license)
|