- 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>
1.5 KiB
1.5 KiB
HarmonyOS 安装配置
包名:@xuqm/harmony-sdk · 版本:0.1.0 · 语言:ArkTS
ohpm 安装
在 HarmonyOS 项目的 oh-package.json5 中添加:
{
"dependencies": {
"@xuqm/harmony-sdk": "^0.1.0"
}
}
然后执行:
ohpm install
发布仓库:
https://ohpm.openharmony.cn/ohpm/
最低 API 版本
- API 12+(HarmonyOS 4.0+)
- DevEco Studio 4.0 Release 或更高版本
权限配置
在 module.json5 中声明所需权限:
{
"module": {
"requestPermissions": [
{
"name": "ohos.permission.INTERNET"
},
{
"name": "ohos.permission.GET_NETWORK_INFO"
}
]
}
}
如需使用相机、相册、麦克风等功能,额外添加:
{
"module": {
"requestPermissions": [
{
"name": "ohos.permission.CAMERA"
},
{
"name": "ohos.permission.READ_MEDIA"
},
{
"name": "ohos.permission.WRITE_MEDIA"
},
{
"name": "ohos.permission.MICROPHONE"
}
]
}
}
初始化
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',
})
登录
const session = await XuqmSDK.login('user_001', 'your_user_sig_jwt')