getGeolocation

Returns the Global Positioning System (GPS) location of a mobile device.

Syntax

ui.Interface.frontCall("mobile", "getGeolocation",
   [], [status, latitude, longitude] )
  1. status - Holds the status of the front call execution.
  2. latitude - Holds the current latitude.
  3. longitude - Holds the current longitude.

Usage

The "getGeolocation" front call returns the current location of the mobile device, based on the current GPS information.

The possible values returned in the status parameter are:
  • "ok": The mobile device location could be found.
  • In case of failre, the status variable contains the error description, for example, "location services not enabled".

The returned coordinates should be stored in FLOAT variables.

If the device location cannot be found within a given period, the front call returns an error status.

Example

DEFINE status STRING, latitude, longitude FLOAT
CALL ui.Interface.frontCall("mobile", "getGeolocation",
     [], [status, latitude, longitude] )
MESSAGE SFMT(
  "Geo location: (status=%1) Latitude=%2 Longitude=%3",
  status, latitude, longitude )