Returns the reading from the named sensor.
Syntax:
mobileSensorReading(<sensor>, <detailed>)
Examples:
get mobileSensorReading("heading",false)
put mobileSensorReading("location",true) into tDeviceLocation
Use the mobileSensorReading function to fetch a reading from the named device sensor.
The mobileSensorReading function returns a reading from the named sensor.
If you are on an Android phone you also need to make sure that you have GPS turned on ("high accuracy") in system settings.
In the Android standalone settings, also make sure you have selected both permissions for "fine location" and "coarse location".
Parameters:
- 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 readi GSM will be provided.
- Returns:
- 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.
- Heading - the heading of the device in degrees. If detailed is true an array containing the key sheading, 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 containin the keys x, y, z and timestamp is returned.
See also: mobileStartTrackingSensor (command), mobileCanTrackHeading (function), mobileCanTrackLocation (function), mobileCurrentHeading (function), mobileCurrentLocation (function), headingChanged (message), accelerationChanged (message), locationChanged (message), rotationRateChanged (message), trackingError (message),