Starting from version 1078, the API prefix has been changed from hbs to qg. The original prefix hbs is still supported.
Parameter | Type | Mandatory | Description |
|---|---|---|---|
type | string | No | The default value is wgs84.
|
altitude | string | No | The default value is false. If true is passed, the altitude information is returned. |
success | function | No | Callback function triggered upon a successful API call. |
fail | function | No | Callback function triggered upon a failed API call. |
complete | function | No | If a function is passed, it will be called regardless of whether the API call succeeds or fails. |
Parameter | Type | Description |
|---|---|---|
latitude | number | Latitude. The value ranges from -90 to 90. A negative value indicates a south latitude. |
longitude | number | Longitude. The value ranges from -180 to 180. A negative value indicates a west longitude. |
speed | number | Speed, in m/s. |
accuracy | number | Location precision. |
altitude | number | Altitude, in m. |
verticalAccuracy | number | Vertical precision, in m. If no value can be obtained, 0 is returned. |
horizontalAccuracy | number | Horizontal precision, in m. |
qg.getLocation({
success : function (res) {
console.log("getLocation success result = " + JSON.stringify(res));
},
fail:function(){
console.log("getLocation fail");
},
complete:function() {
console.log("getLocation complete");
}
});