mobileSensorReading

Typefunction
DictionaryLCS
LibraryLiveCode Script
Syntax
mobileSensorReading(<sensor>, <detailed>)
Summary

Returns the reading from the named sensor.

Introduced5.5
OSios, android
Platformsmobile
Parameters
NameTypeDescription
sensor

The name of the sensor you wish to start using

"location": the location of the device
"heading": the heading of the device
"acceleration": the acceleration of the device
"rotation rate": the rotation of the device
detailed

How detailed the readings from sensors should be. The default value is false

"false": basic readings will be provided.
"true": additional readings will be provided.
Example
get mobileSensorReading("heading",false)
put mobileSensorReading("location",true) into tDeviceLocation
Values
NameTypeDescription
return
  • Location - a comma separated list of the latitude, longitude and altitude of the device. If any of these readings are not available, an empty item will be returned in its place. If detailed is true an array containing the keys latitude, longitude, altitude, timestamp, horizontal accuracy and vertical accuracy is returned. Additionally, if values for them exist, the keys speed and course are included in the returned array.
  • Heading - the heading of the device in degrees. If detailed is true an array containing the keys heading, magnetic heading, true heading, timestamp, x, y, z and accuracy is returned.
  • Acceleration - a comma separated list of the acceleration in the x, y and z axes. If detailed is true an array containing the keys x, y, z and timestamp is returned.
  • Rotation Rate - a comma separated list of the rate of rotation around the x, y and z axes. If detailed is true an array containing the keys x, y, z and timestamp is returned.
RelatedCommand: mobileStopTrackingSensor, mobileStartTrackingSensor
Function: mobileCanTrackHeading, mobileCanTrackLocation, mobileCurrentHeading, mobileCurrentLocation
Message: headingChanged, accelerationChanged, locationChanged, rotationRateChanged, trackingError
Description

Use the mobileSensorReading function to fetch a reading from the named device sensor.

The mobileSensorReading function returns a reading from the named sensor.

Note: When speed is returned, the value is in meters per second. To convert to miles per hour, multiply the value by 2.237. To convert to kilometers per hour, multiply it by 3.6 instead.