mobileCurrentLocation

Typefunction
DictionaryLCS
LibraryLiveCode Script
Syntax
mobileCurrentLocation()
Synonymsiphonecurrentlocation()
Summary

Returns the current location of the device.

Introduced4.5.2
OSios, android
Platformsmobile
Example
put mobileCurrentLocation() into theLocation
Values
NameTypeDescription
return

If location tracking has been enabled the mobileCurrentLocation function returns an array with the following keys

  • "horizontal accuracy": the maximum error in meters of the position indicated by longitude and latitude
  • "latitude": the latitude of the current location, measured in degrees relative to the equator. Positive values indicate positions in the Northern Hemisphere, negative values in the Southern.
  • "longitude": the longitude of the current location, measured in degrees relative to the zero meridian. Positive values extend east of the meridian, negative values extend west.
  • "vertical accuracy": the maximum error in meters of the altitude value.
  • "altitude": the distance in meters of the height of the device relative to sea level. Positive values extend upward of sea:level, negative values downward.
  • "timestamp": the time at which the measurement was taken, in seconds since 1970.

If the latitude and longitude could not be measured, those keys together with the horizontal accuracy key will not be present. If the altitude could not be measured, that key together with the vertical accuracy will not be present.

If location tracking has not been enabled the mobileCurrentLocation function returns empty

RelatedCommand: mobileStopTrackingSensor, mobileStartTrackingSensor
Function: mobileSensorAvailable, mobileSensorReading
Message: trackingError, locationChanged
Description

Use the mobileCurrentLocation function to find the current location of the device.

Use the mobileCurrentLocation function to find the current location of the device. If location tracking has not been enabled this function returns empty. Otherwise it returns an array.

*Note*: Before using the mobileCurrentLocation function, the mobileSensorAvailable function should first be called with the line:

mobileSensorAvailable("location")

Doing this will request the necessary permissions for using location sensors.