HarmonyOS 通过h5定位getCurrentPosition获取到的定位数据为空对象?

如题:HarmonyOS 通过h5定位getCurrentPosition获取到的定位数据为空对象?

阅读 506
1 个回答

需要在module.json5文件中配置ohos.permission.LOCATION,ohos.permission.APPROXIMATELY\_LOCATION权限。

{
  "name":
  "ohos.permission.LOCATION",
  "reason":
  "$string:reason",
  "usedScene":
  {
    "abilities": [
    "FormAbility"
    ]
    ,
    "when":
    "inuse"
  }
}
,
{
  "name":
  "ohos.permission.APPROXIMATELY_LOCATION",
  "reason":
  "$string:reason",
  "usedScene":
  {
    "abilities": [
    "FormAbility"
    ]
    ,
    "when":
    "inuse"
  }
}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进