HarmonyOS 鸿蒙Next中healthKit startSport报错1001
HarmonyOS 鸿蒙Next中healthKit startSport报错1001
环境:
手机品牌:oppo, 系统版本:android 16, hms core 版本:6.15.0.312 运动健康app版本:16.1.3.320
集成方式:
implementation ‘com.huawei.hms:health:6.11.0.303’
implementation ‘com.huawei.hihealth:hihealthkit:6.7.0.300’
implementation ‘com.huawei.hms:base:6.9.0.300’
问题:
请问下这个报错是什么原因,
同样的代码,在华为 p30 手机上可以运行的。
但在其他安卓手机上不行了(在没升级android系统版本之前是可以的)
还是说,安卓的环境不再维护了吗,
调用方法:
HiHealthDataStore.startSportEx(mActivity, param, resultCallback);
错误日志:
D/hi_data_store(23955): startSport 方法 = sportType ==279
I/HiHealthDataStore(23955): enter start sport extra
I/HealthKitCommonApi(23955): HiHealthKitCommonApi construct
I/HealthKitCommonApi(23955): startSportEnhance
I/HiHealthKitVersionUtil(23955): isServiceSupport apiName:register_data_auto_report
I/HiHealthKitVersionUtil(23955): isServiceSupport apiLevel: 20, minSupportApiLevel:9
I/HiHealthDataStore(23955): enter stopRealTimeSportData
I/HiHealthKit(23955): HiHealthKitApi getInstance
I/HiHealthKit(23955): stopRealTimeSportData
I/HiHealthKit(23955): stopRealTimeSportDataImpl errorCode = 0
I/hi_data_store(23955): 启用监听 onResult resultCode:0
I/HealthKitCommonApi(23955): resultCode = 1001
更多关于HarmonyOS 鸿蒙Next中healthKit startSport报错1001的实战教程也可以访问 https://www.itying.com/category-93-b0.html
更多关于HarmonyOS 鸿蒙Next中healthKit startSport报错1001的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html
| 1001 | 隐私权限校验异常,用户未授权,需要提醒用户打开相关权限 |
在设置里打开权限试试,而且安卓的应用都不怎么维护了
找HarmonyOS工作还需要会Flutter的哦,有需要Flutter教程的可以学学大地老师的教程,很不错,B站免费学的哦:https://www.bilibili.com/video/BV1S4411E7LY/?p=17,
为 HealthKit 从 2025 年开始,停止对非华为手机的 Android 13+ 新版本运动服务支持
华为 P30:旧安卓 + 旧运动健康;这样是能跑
OPPO Android 16:新系统 + 新版运动健康;这样就不行,运动记录(startSport)接口被华为屏蔽
你看下面这个文档

错误码1001表示参数无效或权限不足。检查healthKit.startSport传入的参数是否符合接口定义(如运动类型、数据格式),确认已授予“healthkit”权限,并确保在UIAbility生命周期内调用。
错误码1001通常表示当前设备或环境不支持所请求的健康运动增强功能(startSportEx)。从日志看,华为P30可正常运行是因为华为手机预置了完整的HMS及运动健康服务组件,而非华为设备(如OPPO + Android 16)缺少关键后台能力,或当前安装的HMS Core(6.15.0.312)与运动健康App(16.1.3.320)在Android 16下存在兼容性问题。以往低版本Android未触发,现在新系统可能限制了部分接口。Android环境仍在维护,但startSportEx依赖的register_data_auto_report等服务要求运动健康App版本≥特定基线,非华为设备可能未适配。建议检查运动健康App是否支持该运动类型(279),并确认HMS Core与运动健康App均为最新稳定版,或改用基础启动接口规避。


