expo-gaode-map 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/API.md CHANGED
@@ -194,11 +194,35 @@ configure({
194
194
 
195
195
  | 方法 | 参数 | 说明 |
196
196
  |------|------|------|
197
- | `setLocationTimeout` | `number` | 定位超时时间(秒) |
198
- | `setReGeocodeTimeout` | `number` | 逆地理超时时间(秒) |
199
- | `setDesiredAccuracy` | `number` | 期望精度(0-5,0: 最适合导航, 1: 最佳, 2: 10米, 3: 100米, 4: 1公里, 5: 3公里) |
200
- | `setDistanceFilter` | `number` | 距离过滤器(米) |
201
- | `setPausesLocationUpdatesAutomatically` | `boolean` | 是否自动暂停定位更新 |
197
+ | `setLocationTimeout` | `number` | 定位超时时间(秒,默认 2 秒) |
198
+ | `setReGeocodeTimeout` | `number` | 逆地理超时时间(秒,默认 2 秒) |
199
+ | `setDesiredAccuracy` | `number` | 期望精度(0-5,默认 3: 100米精度) |
200
+ | `setDistanceFilter` | `number` | 距离过滤器(米,默认 10 米) |
201
+ | `setPausesLocationUpdatesAutomatically` | `boolean` | 是否自动暂停定位更新(默认 false) |
202
+
203
+ **iOS 默认定位配置:**
204
+
205
+ 根据高德官方推荐,本库采用以下默认配置以实现快速定位:
206
+ - **精度**:`kCLLocationAccuracyHundredMeters`(100米精度,级别 3)
207
+ - **定位超时**:2 秒
208
+ - **逆地理超时**:2 秒
209
+ - **距离过滤**:10 米
210
+
211
+ > **精度说明**:
212
+ > - **百米精度**(推荐):2-3 秒内获取结果,满足大多数应用场景
213
+ > - **高精度**:使用 `setDesiredAccuracy(1)` 切换到 `kCLLocationAccuracyBest`,需配合 `setLocationTimeout(10)` 和 `setReGeocodeTimeout(10)`,约 10 秒获取 10 米精度
214
+ > - 苹果系统首次定位结果为粗定位,高精度需要更长时间
215
+
216
+ **精度级别对照表:**
217
+
218
+ | 级别 | 常量 | 说明 | 推荐超时 |
219
+ |------|------|------|----------|
220
+ | 0 | `kCLLocationAccuracyBestForNavigation` | 最适合导航 | 10 秒 |
221
+ | 1 | `kCLLocationAccuracyBest` | 最佳精度(~10米) | 10 秒 |
222
+ | 2 | `kCLLocationAccuracyNearestTenMeters` | 10米精度 | 5 秒 |
223
+ | 3 | `kCLLocationAccuracyHundredMeters` | 100米精度(默认) | 2-3 秒 |
224
+ | 4 | `kCLLocationAccuracyKilometer` | 1公里精度 | 1 秒 |
225
+ | 5 | `kCLLocationAccuracyThreeKilometers` | 3公里精度 | 1 秒 |
202
226
 
203
227
  ##### 后台定位配置(全平台支持)
204
228
 
@@ -174,10 +174,11 @@ class LocationManager: NSObject, AMapLocationManagerDelegate {
174
174
  private func initLocationManager() {
175
175
  locationManager = AMapLocationManager()
176
176
  locationManager?.delegate = self
177
- locationManager?.desiredAccuracy = kCLLocationAccuracyBest
177
+ // 推荐配置:百米精度,快速定位(2-3秒)
178
+ locationManager?.desiredAccuracy = kCLLocationAccuracyHundredMeters
178
179
  locationManager?.distanceFilter = 10
179
- locationManager?.locationTimeout = 10 // 10秒超时
180
- locationManager?.reGeocodeTimeout = 5 // 5秒超时
180
+ locationManager?.locationTimeout = 2 // 2秒超时
181
+ locationManager?.reGeocodeTimeout = 2 // 2秒超时
181
182
  locationManager?.locatingWithReGeocode = true
182
183
 
183
184
  // iOS 9 之前:防止后台被系统挂起(默认关闭,用户可通过 setPausesLocationUpdatesAutomatically 配置)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-gaode-map",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "一个功能完整的高德地图 React Native 组件库,基于 Expo Modules 开发,提供地图显示、定位、覆盖物等功能。",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",