HarmonyOS 开启位置变化订阅,无Callback回调?

开启了位置变化订阅后,callback一直无回调定位信息

let requestInfo: geoLocationManager.LocationRequest = {
  'scenario': geoLocationManager.LocationRequestScenario.TRAJECTORY_TRACKING,
  'timeInterval': 10,
  'distanceInterval': 0,
  'maxAccuracy': 0
};

let locationChange = (location: geoLocationManager.Location): void => {
  PAPCLogUtils.logE("LocationHelp", 'locationChanger: data: ' + JSON.stringify(location));
};

PAPCLocationUtils.onLocationChange(context as common.UIAbilityContext, true, requestInfo, this.locationChange);
阅读 605
1 个回答

在室内是没有GNSS信号的。在室内使用first\_fix,在室外情况下再尝试使用以上代码

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进