更新记录

1.0.1(2024-11-08) 下载此版本

完善使用文档

1.0.0(2024-11-08) 下载此版本

初次发布


平台兼容性

uni-app x

Chrome Safari Android iOS 鸿蒙 微信小程序
- - × × ×

鸿蒙腾讯定位

配置权限

在鸿蒙配置文件中配置权限

  {
   "name": "ohos.permission.APPROXIMATELY_LOCATION",
   "reason": "$string:module_desc",
   "usedScene": {
     "abilities": [
       "EntryAbility"
     ],
     "when": "inuse"
   }
 },
 {
   "name": "ohos.permission.LOCATION",
   "reason": "$string:module_desc",
   "usedScene": {
     "abilities": [
       "EntryAbility"
     ],
     "when": "inuse"
   }
 }

使用

前往源码文件中填入自己的腾讯定位的key 源码目录 harmony-txGetLocation\utssdk\app-harmony\index.uts 94行

await TencentLocationSDK.init(context, '填写你的腾讯定位KEY', util.generateRandomUUID(true))

然后劫持掉 uni.getLocation

import * as tc from "@/uni_modules/harmony-txGetLocation";

    uni.addInterceptor('getLocation', {
        invoke(args) {
            if (args.nav) return;
            tc.getLocation({
                ...args,
                success: args?.success,
                fail: args?.fail,
                complete: args?.complete
            })
            return false;
        }
    })

隐私、权限声明

1. 本插件需要申请的系统权限列表:

ohos.permission.APPROXIMATELY_LOCATION ohos.permission.LOCATION

2. 本插件采集的数据、发送的服务器地址、以及数据用途说明:

3. 本插件是否包含广告,如包含需详细说明广告表达方式、展示频率:

许可协议

MIT协议

暂无用户评论。

使用中有什么不明白的地方,就向插件作者提问吧~ 我要提问