getLocation(params: Object)
Requires:
MapKit≥1.0.6@ray-js/ray≥1.2.10
Platforms:
iOSAndroid
Description
Get current location and speed
Parameters
| Property | Type | Required | Description |
|---|---|---|---|
type | string | Yes | wgs84 returns GPS coordinates; gcj02 returns coordinates usable with openLocation |
altitude | boolean | Yes | Passing true returns altitude. Because obtaining altitude requires higher accuracy, it will slow the API response. |
isHighAccuracy | boolean | Yes | Enable high-accuracy location |
highAccuracyExpireTime | number | Yes | High-accuracy location timeout (ms). Returns the highest possible accuracy within the specified time. High-accuracy positioning only takes effect when this value is greater than 3000 ms. |
complete | () => void | No | Completion callback (executed on both success and failure) |
success | (params: Object) => void | No | Callback on successful API call |
fail | (params: Object) => void | No | Failure callback |
success callback parameters
| Property | Type | Description | MapKit Since |
|---|---|---|---|
latitude | number | Latitude, range -90 to 90; negative values indicate south | v3.0.5 |
longitude | number | Longitude, range -180 to 180; negative values indicate west | v3.0.5 |
speed | number | Speed, unit: m/s | v3.0.5 |
accuracy | number | Location accuracy | v3.0.5 |
altitude | number | Altitude, unit: m | v3.0.5 |
verticalAccuracy | number | Vertical accuracy, in meters (not available on Android, returns 0) | v3.0.5 |
horizontalAccuracy | number | Horizontal accuracy, in meters | v3.0.5 |
cityName | string | City name | v3.0.5 |
streetName | string | Street name | v3.0.5 |
address | string | Location name. Historically, iOS returned an Array; use the formatAddress field instead | v3.0.5 |
formatAddress | string | Formatted address | v3.6.0 |
countryCode | string | Country code | v3.1.0 |
postalCode | string | Postal code | v3.1.0 |
countryName | string | Country name | v3.1.1 |
province | string | Province name | v3.1.1 |
district | string | District/county name (second-level administrative region) | v3.1.1 |
fail callback parameters
| Property | Type | Description |
|---|---|---|
errorMsg | string | Error message |
errorCode | string | number | Error code |
| Error extension |
Return Value
None