sud.getLocation
JS
sud.getLocation(Object object)Gets the current geolocation and speed.
Parameters
- Object object: Input parameters, described below.
Properties of object:
| Property | Value Type | Required | Description |
|---|---|---|---|
| type | string | No | Defaults to wgs84 coordinates; supports gcj02 and bd09 coordinates |
| altitude | string | No | Defaults to false; passing true returns altitude information |
| isHighAccuracy | boolean | No | Defaults to false; passing true enables high-accuracy positioning |
| highAccuracyExpireTime | number | No | High-accuracy positioning timeout (ms); returns the highest accuracy within the specified time. High-accuracy positioning is only effective when this value is above 3000ms |
| success | function | No | Callback function for a successful API call |
| fail | function | No | Callback function for a failed API call |
| complete | function | No | Callback function for API call completion |
Parameters of the success callback function
- Object res: Returns geolocation information.
Properties of res:
| Property | Value Type | Description |
|---|---|---|
| latitude | number | Latitude, range -90~90; negative values indicate south latitude |
| longitude | number | Longitude, range -180~180; negative values indicate west longitude |
| speed | number | Speed, in m/s |
| accuracy | number | Accuracy of the location |
| altitude | number | Altitude, in m |
| verticalAccuracy | number | Vertical accuracy, in m (unavailable below Android 8.0, returns 0) |
| horizontalAccuracy | number | Horizontal accuracy, in m |
