{"id":14957144,"url":"https://github.com/uiwjs/react-native-amap-geolocation","last_synced_at":"2025-04-13T04:17:17.125Z","repository":{"id":52548875,"uuid":"282139762","full_name":"uiwjs/react-native-amap-geolocation","owner":"uiwjs","description":"React Native 高德地图定位模块，支持 Android/iOS。","archived":false,"fork":false,"pushed_at":"2025-04-08T16:41:08.000Z","size":8317,"stargazers_count":45,"open_issues_count":17,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-13T04:16:50.707Z","etag":null,"topics":["amap","amap-app","amapsdk","android","geolocation","ios","react","react-amap","react-native","react-native-component"],"latest_commit_sha":null,"homepage":"https://uiwjs.github.io/react-native-amap-geolocation/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uiwjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-24T06:20:19.000Z","updated_at":"2025-03-12T14:02:12.000Z","dependencies_parsed_at":"2023-09-22T03:00:59.409Z","dependency_job_id":"e9f84221-efd0-4351-8555-3b3a3afb98ea","html_url":"https://github.com/uiwjs/react-native-amap-geolocation","commit_stats":{"total_commits":83,"total_committers":4,"mean_commits":20.75,"dds":0.1325301204819277,"last_synced_commit":"d6db85d10739e66b05c10b77a68d5c61e30e7bbb"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uiwjs%2Freact-native-amap-geolocation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uiwjs%2Freact-native-amap-geolocation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uiwjs%2Freact-native-amap-geolocation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uiwjs%2Freact-native-amap-geolocation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uiwjs","download_url":"https://codeload.github.com/uiwjs/react-native-amap-geolocation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248661713,"owners_count":21141451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amap","amap-app","amapsdk","android","geolocation","ios","react","react-amap","react-native","react-native-component"],"created_at":"2024-09-24T13:14:13.726Z","updated_at":"2025-04-13T04:17:17.097Z","avatar_url":"https://github.com/uiwjs.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"@uiw/react-native-amap-geolocation\n----\n\n[![NPM Version](https://img.shields.io/npm/v/@uiw/react-native-amap-geolocation.svg)](https://npmjs.org/package/@uiw/react-native-amap-geolocation)\n![SDK-6.2.0](https://shields.io/badge/SDK-6.2.0-green?logo=android\u0026style=flat)\n![AMapLocation-2.9.0](https://shields.io/badge/AMapLocation-2.9.0-green?logo=apple\u0026style=flat)\n![David](https://img.shields.io/david/peer/uiwjs/react-native-amap-geolocation)\n\nReact Native 高德地图定位模块，支持 Android/iOS。提供尽可能完善的原生接口，同时提供符合 Web 标准的 Geolocation API 以及 [完整的接口文档](https://uiwjs.github.io/react-native-amap-geolocation/)。\n\n## 注意事项\n\n⚠️ 高德地图定位部分 API 需要真机调试和 `Access WiFi Information` 权限。\n\n\u003cdetails\u003e\n\u003csummary\u003eAndroid：需要正确的设置 apiKey，获取 Key 的方法\u003c/summary\u003e\n\n\u003cbr /\u003e\n\n官方获取 Key方法：https://lbs.amap.com/api/android-location-sdk/guide/create-project/get-key\n\nA. 使用 `keytool`（jdk自带工具）获取 `SHA1`，默认 测试版本 `keystore` 路径 `\u003c项目名称\u003e/android/app/debug.keystore`\n\n```bash\nkeytool -v -list -keystore  keystore文件路径\n```\n\nB. 获取 `PackageName`，获取路径 `\u003c项目名称\u003e/android/app/src/main/AndroidManifest.xml`\n\nC. 在高德地图账号中设置 `SHA1` 和 `PackageName`。\n\n\u003cimg src=\"https://raw.githubusercontent.com/uiwjs/react-native-amap-geolocation/master/imgs/sha1.png\" /\u003e\n\nD. 按照上面步骤正确设置你的 `apiKey` 才会起作用。\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eAndroid：无法获取逆地理信息的问题，KEY鉴权失败\u003c/summary\u003e\n\n1. APK 当前签名文件的 SHA1 与[高德开放平台](https://console.amap.com/)中设置不一致\n2. Android Studio 开发者请注意调整 `build.gradle` 文件的 `applicationId` 与 `packageName` 一致，如不一致将会导致鉴权失败。\n3. 工程中的 `packageName` 与[高德开放平台](https://console.amap.com/)中 `packageName` 设置不一致\n4. 通过 `SDK` 提供的 `setApiKey(String key);` 接口设置 `Key`，注意 `Key` 设置要在 `SDK` 业务初始化之前。\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eiOS：获取逆地理信息需要高德地图配置 apiKey\u003c/summary\u003e\n\n\u003cimg src=\"https://raw.githubusercontent.com/uiwjs/react-native-amap-geolocation/master/imgs/amapkey.png\" /\u003e\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eiOS：高德地图包需要 WiFi 权限\u003c/summary\u003e\n\n\u003cbr /\u003e\n\niOS 端高德地图包需要 WiFi 权限，否则报如下警告：\n\n```\nnehelper sent invalid result code [1] for Wi-Fi information request\n```\n\n需要在[开发者账号中设置 WiFi 权限](https://developer.apple.com)\n\n\u003cimg src=\"https://raw.githubusercontent.com/uiwjs/react-native-amap-geolocation/master/imgs/identifiers.png\" /\u003e\n\n同时需要在 Xcode 中添加 `Access WiFi Information` 能力选项\n\n\u003cimg src=\"https://raw.githubusercontent.com/uiwjs/react-native-amap-geolocation/master/imgs/xcode.png\" /\u003e\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eiOS：需要保证\"Background Modes\"中的\"Location updates\"处于选中状态\u003c/summary\u003e\n\n\u003cimg src=\"https://raw.githubusercontent.com/uiwjs/react-native-amap-geolocation/master/imgs/xcode.png\" /\u003e\n\n1. 左侧目录中选中工程名，开启 `TARGETS` -\u003e `Capabilities` -\u003e `Background Modes`\n2. 在 `Background Modes` 中勾选 `Location updates`\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eAndroid：获取 apikey 失败 errorCode : 10001\u003c/summary\u003e\n\n```bash\n原因：***确保调用SDK任何接口前先调用更新隐私合规updatePrivacyShow、updatePrivacyAgree两个接口并且参数值都为true，若未正确设置有崩溃风险***\n使用loc SDK 功能使用前请确保已经正确设置apiKey，如有疑问请在高德开放平台官网中搜索【INVALID_USER_KEY】相关内容进行解决。\n```\n\n解决方法：重新申请 `apikey`\n\n\u003c/details\u003e\n\n\n\u003cdetails\u003e\n\u003csummary\u003eAndroid：new NativeEventEmitter()` was called with a non-null argument without the required `addListener` method\u003c/summary\u003e\n\n```bash\nWARN  `new NativeEventEmitter()` was called with a non-null argument without the required `addListener` method.\nWARN  `new NativeEventEmitter()` was called with a non-null argument without the required `removeListeners` method.\n```\n\n解决方法：重新申请 `apikey`\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eAndroid：请在高德开放平台官网中搜索\"SERVICE_NOT_EXIST\"相关内容进行解决\u003c/summary\u003e\n\n```bash\n请在高德开放平台官网中搜索\"SERVICE_NOT_EXIST\"相关内容进行解决\n```\n\n解决方法：[重新申请 `apikey`](https://lbs.amap.com/cooperation/technical_advisory/?tab=4)\n\n![](./imgs/SERVICE_NOT_EXIST.png)\n\n\u003c/details\u003e\n\n## 安装依赖\n\n```bash\nyarn add @uiw/react-native-amap-geolocation\n# react-native version \u003e= 0.60+\n$ cd ios \u0026\u0026 pod install\n```\n\n## 基本用法\n\n```javascript\nimport { PermissionsAndroid } from \"react-native\";\nimport { Platform } from 'react-native';\nimport AMapGeolocation from '@uiw/react-native-amap-geolocation';\n\nawait PermissionsAndroid.requestMultiple([\n  PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,\n  PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION,\n]);\n\nlet apiKey = '';\n\nif (Platform.OS === 'ios') {\n  apiKey = '用于 iOS 的 apiKey';\n}\nif (Platform.OS === 'android') {\n  apiKey = '用于 Android 的 apiKey';\n}\n\n// 设置 高德地图 apiKey\nAMapGeolocation.setApiKey(apiKey);\n// iOS 指定所需的精度级别\nAMapGeolocation.setDesiredAccuracy(3);\n// Android 指定所需的精度级别，可选设置，默认 高精度定位模式\nAMapGeolocation.setLocationMode(1);\n// 定位是否返回逆地理信息\nAMapGeolocation.setLocatingWithReGeocode(true);\n// 开始定位\nAMapGeolocation.start();\n// 停止更新位置信息\nAMapGeolocation.stop();\n// 是否已经开始持续定位了\nAMapGeolocation.isStarted();\n// 在某些情况获取不到数据，建议使用 `addLocationListener` 来实现\nasync function getCurrentLocation(){\n  try {\n    const json = await AMapGeolocation.getCurrentLocation();\n    console.log('json:', json);\n  } catch (error) {\n    console.log('error:', error);\n  }\n}\n```\n\n## 定位监听函数\n\n```js\nimport AMapGeolocation from '@uiw/react-native-amap-geolocation';\n\nlet apiKey = '';\nif (Platform.OS === 'ios') {\n  apiKey = '用于 iOS 的 apiKey';\n}\nif (Platform.OS === 'android') {\n  apiKey = '用于 Android 的 apiKey';\n}\n\n// 设置 高德地图 apiKey\nAMapGeolocation.setApiKey(apiKey);\n// 定位是否返回逆地理信息\nAMapGeolocation.setLocatingWithReGeocode(true);\n\n// 必须，启动开始定位，addLocationListener 监听函数才有效\nAMapGeolocation.start();\n// 当设备可以正常联网时，还可以返回该定位点的对应的中国境内位置信息（包括：省、市、区/县以及详细地址）。\nconst listener = AMapGeolocation.addLocationListener((location) =\u003e {\n  console.log('返回定位信息', location);\n  this.setState({\n    location: JSON.stringify(location, null, 2), \n  });\n});\n// 移除监听事件\nlistener.remove();\n// 开启监听\nAMapGeolocation.start();\n```\n\n## 逆地理编码\n\n```js\nimport AMapGeolocation from '@uiw/react-native-amap-geolocation';\n\nlet apiKey = '';\nif (Platform.OS === 'ios') {\n  apiKey = '用于 iOS 的 apiKey';\n}\nif (Platform.OS === 'android') {\n  apiKey = '用于 Android 的 apiKey';\n}\n\n// 设置 高德地图 apiKey\nAMapGeolocation.setApiKey(apiKey);\n// 定位是否返回逆地理信息\nAMapGeolocation.setLocatingWithReGeocode(true);\n```\n\n## 坐标转换\n\n坐标转换，支持将iOS自带定位 GPS/Google/MapBar/Baidu/MapABC 多种坐标系的坐标转换成高德坐标\n\n```js\nimport AMapGeolocation from '@uiw/react-native-amap-geolocation';\n\n// 将百度地图转换为 高德地图 经纬度\nconst resulte = await AMapGeolocation.coordinateConvert({\n  latitude: 40.002172,\n  longitude: 116.467357,\n}, 0);\n// =\u003e {longitude: 116.46071927031961, latitude: 39.99651501274128}\n```\n\n## 定位回调频率限制\n\n```js\nimport AMapGeolocation from '@uiw/react-native-amap-geolocation';\n\n// android，5 秒请求一次定位\nAMapGeolocation.setInterval(5000);\n\n// ios，设备移动超过 10 米才会更新位置信息\nAMapGeolocation.setDistanceFilter(10);\n```\n\n## API\n\n```ts\n/** 一个地理坐标点。 */\nexport interface Point {\n  /** 纬度 */\n  latitude: number;\n  /** 经度 */\n  longitude: number;\n}\n\n/**\n * 坐标信息\n * @see https://developer.mozilla.org/zh-CN/docs/Web/API/Coordinates\n */\nexport interface Coordinates extends Point {\n  /** 高度 - 海拔高度，以米为单位。 */\n  altitude: number;\n  /** 水平精度 - 位置的不确定性半径，以米为单位。 */\n  accuracy: number;\n  /** 移动方向，需要 GPS */\n  heading: number;\n  /** 移动速度（米/秒），需要 GPS */\n  speed: number;\n  /** 时间戳记 - 确定此位置的时间。 */\n  timestamp: number;\n  /**\n   * 是否有可用坐标\n   * @platform ios\n   */\n  isAvailableCoordinate?: boolean;\n}\n\n/**\n * 逆地理信息 + 坐标信息\n */\nexport interface ReGeocode extends Coordinates {\n  /** 格式化地址 */\n  address: string;\n  /** 国家 */\n  country: string;\n  /** 省/直辖市，如 `湖北省` */\n  province: string;\n  /** 市，如 `武汉市`。对应城市{@link cityCode}编码 */\n  city: string;\n  /** 区，如 `武昌区`。对应区域{@link adCode}编码 */\n  district: string;\n\n  // ///乡镇\n  // // 该字段从v2.2.0版本起不再返回数据,建议您使用AMapSearchKit的逆地理功能获取.\n  // township: string;\n\n  // ///社区\n  // // 该字段从v2.2.0版本起不再返回数据,建议您使用AMapSearchKit的逆地理功能获取.\n  // neighborhood: string;\n\n  // ///建筑\n  // // 该字段从v2.2.0版本起不再返回数据,建议您使用AMapSearchKit的逆地理功能获取.\n  // building: string;\n\n  /** 城市编码 */\n  cityCode: string;\n  /** * 区域编码 */\n  adCode: string;\n  /** 街道名称 */\n  street: string;\n  /** 门牌号 */\n  streetNumber: string;\n  /** 兴趣点名称 */\n  poiName: string;\n  /** 所属兴趣点名称 */\n  aoiName: string;\n  /**\n   * 获取定位信息描述\n   * @version SDK2.0.0 开始支持\n   * @platform android\n   */\n  description?: string;\n  /**\n   * 获取坐标系类型 高德定位sdk会返回两种坐标系：\n   * 坐标系 AMapLocation.COORD_TYPE_GCJ02 -- GCJ02\n   * 坐标系 AMapLocation.COORD_TYPE_WGS84 -- WGS84\n   * 国外定位时返回的是WGS84坐标系\n   * @platform android\n   */\n  coordType?: 'GCJ02' | 'WGS84';\n  /**\n   * 返回支持室内定位的建筑物ID信息\n   * @platform android\n   */\n  buildingId?: string;\n}\n/**\n * 配置高德地图 Key\n * -\n * - [高德获取 iOS key 文档地址](https://lbs.amap.com/api/ios-location-sdk/guide/create-project/get-key)\n * - [高德获取 Android key 文档地址](https://lbs.amap.com/api/android-location-sdk/guide/create-project/get-key)\n *\n * 注意：安卓设置 key 很重要，由于在 android 平台必须优先设置 ApiKey 才能初始化 地图实例。\n * 所以这个方法在android 平台下，还附带了初始化地图实例。\n */\nexport function setApiKey(scheme: string): void;\n/**\n * 开始连续定位\n */\nexport function start(): void;\n/**\n * 停止更新位置信息\n */\nexport function stop(): void;\n\n/**\n * 开始获取设备朝向，如果设备支持方向识别，则会通过代理回调方法-wx\n * @platform ios\n */\nexport function startUpdatingHeading(): void;\n\n/**\n * 停止获取设备朝向-wx\n * @platform ios\n */\nexport function stopUpdatingHeading(): void;\n\n/**\n * 是否已经开始持续定位了\n */\nexport function isStarted(): Promise\u003cBoolean\u003e;\n/**\n * 用于指定所需的精度级别。\n * 单位米，默认为 kCLLocationAccuracyBest。定位服务会尽可能去获取满足desiredAccuracy的定位结果，但不保证一定会得到满足期望的结果。\n * 注意：设置为 kCLLocationAccuracyBest 或 kCLLocationAccuracyBestForNavigation 时，\n * 单次定位会在达到 locationTimeout 设定的时间后，将时间内获取到的最高精度的定位结果返回。\n * 高德提供了 kCLLocationAccuracyBest 参数，设置该参数可以获取到精度在10m 左右的定位结果，但是相应的需要付出比较长的时间（10s左右），\n * 越高的精度需要持续定位时间越长。\n * 推荐：kCLLocationAccuracyHundredMeters，一次还不错的定位，偏差在百米左右，超时时间设置在2s-3s左右即可。\n *\n * @param {number} accuracy 1\n * - 0 =\u003e kCLLocationAccuracyBestForNavigation\n * - 1 =\u003e kCLLocationAccuracyBest\n * - 2 =\u003e kCLLocationAccuracyNearestTenMeters\n * - 3 =\u003e kCLLocationAccuracyHundredMeters\n * - 4 =\u003e kCLLocationAccuracyKilometer\n * - 5 =\u003e kCLLocationAccuracyThreeKilometers\n * @platform ios\n */\nexport function setDesiredAccuracy(accuracy: 0 | 1 | 2 | 3 | 4 | 5): void;\n/**\n * 坐标转换，支持将iOS自带定位 GPS/Google/MapBar/Baidu/MapABC 多种坐标系的坐标转换成高德坐标\n *\n * - -1 -\u003e `AMapCoordinateTypeAMap`     // \u003cAMap\n * - 0 -\u003e `AMapCoordinateTypeBaidu`     // \u003cBaidu\n * - 1 -\u003e `AMapCoordinateTypeMapBar`    // \u003cMapBar\n * - 2 -\u003e `AMapCoordinateTypeMapABC`    // \u003cMapABC\n * - 3 -\u003e `AMapCoordinateTypeSoSoMap`   // \u003cSoSoMap\n * - 4 -\u003e `AMapCoordinateTypeAliYun`    // \u003cAliYun\n * - 5 -\u003e `AMapCoordinateTypeGoogle`    // \u003cGoogle\n * - 6 -\u003e `AMapCoordinateTypeGPS`       // \u003cGPS\n * @param coordinate 待转换的经纬度\n * @param type 坐标系类型，对应的序号\n * 如：coordinate = { latitude: 40.002172, longitude: 116.467357 }\n */\nexport function coordinateConvert(coordinate: Point, type: -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6): Promise\u003cPoint\u003e;\n/**\n * 设置发起定位请求的时间间隔，单位：毫秒，默认值：2000毫秒\n * @platform android\n * @default 2000\n */\nexport function setInterval(interval: number): void;\n/**\n * 指定定位是否会被系统自动暂停。默认为 false\n * @platform ios\n * @param value false\n */\nexport function setPausesLocationUpdatesAutomatically(value: boolean): void;\n/**\n * 是否允许后台定位。默认为NO。只在iOS 9.0及之后起作用。\n * 设置为YES的时候必须保证 Background Modes 中的 Location updates 处于选中状态，否则会抛出异常。\n * @platform ios\n * @param value false\n */\nexport function setAllowsBackgroundLocationUpdates(value: boolean): void;\n/**\n * 设定定位的最小更新距离。单位米，默认，表示只要检测到设备位置发生变化就会更新位置信息。\n * @platform ios\n */\nexport function setDistanceFilter(time: number): void;\n/**\n * 定位超时时间，最低2s\n * @platform ios\n */\nexport function setLocationTimeout(number: number): void;\n/**\n * 逆地理请求超时时间，最低 2s，默认为2s 注意在单次定位请求前设置。\n * @platform ios\n */\nexport function setReGeocodeTimeout(number: number): void;\n/**\n * 获取当前定位\n * 默认只获取经纬度，`iOS` 通过 {@linkcode setLocatingWithReGeocode}  设置，是否返回逆地理信息\n */\nexport function getCurrentLocation(): Promise\u003cCoordinates | ReGeocode\u003e;\n/**\n * 定位是否返回逆地理信息，为了与 android 保持一致，默认 值为 true。\n * @platform ios 默认值：false, 返回地址信息，需要手动设置\n * @platform android 默认值：true, 返回地址信息\n * @default true\n */\nexport function setLocatingWithReGeocode(isReGeocode: boolean): void;\n/**\n * 设置定位模式。\n * 默认值：`Hight_Accuracy` 高精度模式\n * android 默认定位模式，目前支持三种定位模式\n * - 1 =\u003e `Hight_Accuracy` 高精度定位模式：在这种定位模式下，将同时使用高德网络定位和卫星定位,优先返回精度高的定位\n * - 2 =\u003e `Battery_Saving` 低功耗定位模式：在这种模式下，将只使用高德网络定位\n * - 3 =\u003e `Device_Sensors` 仅设备定位模式：在这种模式下，将只使用卫星定位。\n * @param {number} mode `1~3`\n * @platform android\n * @default 1\n */\nexport function setLocationMode(mode: 1 | 2 | 3): void;\n/**\n * 设置是否单次定位\n * @default false\n * @platform android\n */\nexport function setOnceLocation(isOnceLocation: boolean): void;\n/**\n * 设置是否使用设备传感器。是否开启设备传感器，当设置为true时，网络定位可以返回海拔、角度和速度。\n * @default false\n * @platform android\n */\nexport function setSensorEnable(sensorEnable: boolean): void;\n/**\n * 设置是否允许调用 WIFI 刷新。\n * 默认值为true，当设置为false时会停止主动调用WIFI刷新，将会极大程度影响定位精度，但可以有效的降低定位耗电\n * @platform android\n * @default true\n */\nexport function setWifiScan(isOnceLocation: boolean): void;\n/**\n * 设置逆地理信息的语言，目前之中中文和英文。\n * @default DEFAULT\n */\nexport function setGeoLanguage(language: 'DEFAULT' | 'EN' | 'ZH'): void;\n/**\n * 连续定位监听事件\n * @param {Function} listener\n */\nexport function addLocationListener(listener?: (location: Coordinates | ReGeocode) =\u003e void): void;\n\n/**\n * 设置是否gps优先-wx\n * 只有在单次定位高精度定位模式下有效\n * 设置为true时，会等待卫星定位结果返回，最多等待30秒，若30秒后仍无卫星定位结果返回，返回网络定位结果\n * @default false\n * @platform android\n */\nexport function setGpsFirst(isSetGpsFirst: boolean): void;\n\n/**\n * 设置定位是否等待WIFI列表刷新-wx\n * 定位精度会更高，但是定位速度会变慢1-3秒\n * 从3.7.0版本开始，支持连续定位（连续定位时首次会等待刷新） 3.7.0之前的版本，仅适用于单次定位，当设置为true时，连续定位会自动变为单次定位,\n * @default false\n * @platform android\n */\nexport function setOnceLocationLatest(isOnceLocationLatest: boolean): void;\n\n/**\n * 设置是否使用缓存策略, 默认为true 使用缓存策略\n * @default true\n * @platform android\n */\nexport function setLocationCacheEnable(isLocationCacheEnable: boolean): void;\n\n/**\n * 设置网络请求超时时间。默认为30秒。在仅设备模式下无效\n * @default 30000\n * @platform android\n */\nexport function setHttpTimeOut(httpTimeOut: number): void;\n\n/**\n * 设置网络请求的协议。默认为HTTP协议。可选HTTP或者HTTPS\n * @default HTTP\n * @platform android\n */\nexport function setLocationProtocol(amapLocationProtocol: 'HTTP' | 'HTTPS'): void;\n```\n\n## 错误处理\n\n```bash\n[NetworkInfo] Signal strength query returned error: Error Domain=NSPOSIXErrorDomain Code=13 \"Permission denied\", descriptor: \u003cCTServiceDescriptor 0x283317100, domain=1, instance=1\u003e\n```\n\n在 `Product` -\u003e `Scheme` -\u003e `Edit Scheme` -\u003e `Run` -\u003e `Arguments` -\u003e `Environment Variables` 添加 `OS_ACTIVITY_MODE` `disable`\n\n```bash\nnehelper sent invalid result code [1] for Wi-Fi information request\n```\n\n配置 WiFi 权限\n\n## 其它\n\n当前工程基于 [@brodybits/create-react-native-module](https://github.com/brodybits/create-react-native-module) 初始化。\n\n```bash\nnpx create-react-native-module --package-identifier com.uiwjs.example.geolocation --object-class-name RNAMapGeolocation --generate-example AMapGeolocation --example-react-native-version 0.63.0 --module-name @uiw/react-native-amap-geolocation --github-account uiwjs --author-name \"Kenny Wong\" --author-email \"wowohoo@qq.com\"\n```\n\n## 开发\n\n```bash\ncd example   # 进入实例 example 工程，根目录不需要安装，会引发错误\nyarn install # 安装依赖\n\ncd ios     # 进入 example/ios 目录安装依赖\npod instll # 安装依赖\n```\n\n## 相关连接 \n\n- [高德地图：Android 端类文档](http://amappc.cn-hangzhou.oss-pub.aliyun-inc.com/lbs/static/unzip/Android_Location_Doc/index.html)\n- [高德地图：iOS定位SDK V2.6.5](https://lbs.amap.com/api/ios-location-sdk/download/)\n- [高德地图：Android 定位SDK V5.1.0](https://lbs.amap.com/api/android-location-sdk/download)\n- [高德地图：提交 AppStore 必读](https://lbs.amap.com/api/ios-location-sdk/guide/create-project/idfa-guide)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuiwjs%2Freact-native-amap-geolocation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuiwjs%2Freact-native-amap-geolocation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuiwjs%2Freact-native-amap-geolocation/lists"}