You are here: GeoLocation API

GeoLocation API

The GeoLocation API defines a high-level interface to location information, such as latitude and longitude associated with the mobile device. The API uses the common sources of location information such as the Global Positioning System (GPS) to infer details such as IP address, RFID, WiFi and Bluetooth MAC addresses, and GSM/CDMA cell IDs. This API does not always return the device's actual location.

The Geolocation API uses the kony.location Namespace and the following API elements.

Function Description
kony.location.getCurrentPosition Retrieves the current location of the device.
kony.location.watchPosition Sets callbacks that report the device's position.
kony.location.clearWatch Verifies the value of the given watchID argument. If the value corresponds to a previously started watch process, the process is stopped immediately.
 

The API is designed to enable both one-shot position (getCurrentPosition) requests and repeated position (watchPosition) updates, as well as the ability to explicitly query the cached positions. Location information is represented by latitude and longitude coordinates.

The GeoLocation APIs are modeled after W3C GeoLocation specification. For a more hands-on approach on the functionality of the various Geolocation APIs provided by Kony AppPlatform, import and preview the Geolocation Feature app by using Kony Visualizer.

To get the current position of the device, use the kony.location.getCurrentPosition function. Continue to watch the position of the device by using the kony.location.watchPosition function. To stop tracking the device movement, use the kony.location.clearWatch function.

Note: The phone.mylocation function is deprecated and should not be used in new software. However, there is still documentation for it.

To view the functionality of the GeoLocation API in action, download the sample application from the link below. Once the application is downloaded, build and preview the application using the Kony Quantum App.

 

 

 

 

RevAuthorEdits
8.4PGPG

 

 

 

 

 

 

Copyright © 2013 Kony, Inc. All rights reserved.