You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Wear OS模拟器中通过Health Services模拟位置?

Wear OS模拟器中Exercise Client固定返回伦敦位置的问题

我按照《Active data and exercises》指南配置了Exercise Client,在实体三星Galaxy Watch 5设备上能正常获取实时位置,但在Android Studio的Wear OS模拟器中,收到的位置始终是固定坐标纬度51.530211685534,经度-0.12388666083292(位于伦敦)。

初始化Exercise Client代码

healthClient.exerciseClient.setUpdateCallback(excerciseUpdateCallback);

val exerciseConfig = ExerciseConfig(ExerciseType.BIKING, setOf(DataType.LOCATION), false, true);

healthClient.exerciseClient.startExerciseAsync(exerciseConfig);

接收位置更新代码

override fun onExerciseUpdateReceived(update: ExerciseUpdate) {
    println("Recorder: onExerciseUpdate");

    val latestMetrics = update.latestMetrics;
    val locationUpdates = latestMetrics.getData(DataType.LOCATION);
    
    if(locationUpdates.isNotEmpty()) {
        val location = locationUpdates.last();

        println("Last longitude " + location.value.latitude + " longitude " + location.value.longitude);
    }
}

运行后固定输出

Recorder: onExerciseUpdate
Last longitude 51.530211685534 longitude -0.12388666083292

启动时控制台报错

set_timerslack_ns write failed: Operation not permitted

当前仅运行exercise update回调和UI,未执行其他操作。尝试设置静态位置点和路由,坐标均无变化。该问题仅存在于模拟器中,实体设备运行正常。使用的模拟器为Android Studio最新版本:

Wear OS Large Round API 30
Android 11.0 Wear OS 3 x86

内容的提问来源于stack exchange,提问作者Nora Söderlund

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.15 00:01:10