We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All
quickApp ReferencesQuick GameRuntime Quick GameLocation

Location

NOTE

Starting from version 1078, the API prefix has been changed from hbs to qg. The original prefix hbs is still supported.

Definition

Expand

API

Description

qg.getLocation(Object object)

Obtains the current location and speed.

qg.getLocation(Object object)

  • Description

    Obtains the current location and speed.

  • Parameters
    Expand

    Parameter

    Type

    Mandatory

    Description

    type

    string

    No

    The default value is wgs84.

    • wgs84: GPS coordinates
    • gcj02: GCJ-02 coordinates

    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.

    • Parameters in the success callback function
      Expand

      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.

  • Sample code
    Collapse
    Word wrap
    Dark theme
    Copy code
    1. qg.getLocation({
    2. success : function (res) {
    3. console.log("getLocation success result = " + JSON.stringify(res));
    4. },
    5. fail:function(){
    6. console.log("getLocation fail");
    7. },
    8. complete:function() {
    9. console.log("getLocation complete");
    10. }
    11. });
Search in References
Enter a keyword.