Reference > Functions reference > Mobile functions > GetSensor
 

GetSensor

Returns the value of a specified sensor for an iOS device.

Format 

GetSensor ( sensorName {; option1 ; option2 } )

Parameters 

sensorName - the name of a supported sensor (see below).

option1 - optional parameter for the specified sensor.

option2 - optional parameter for the specified sensor.

Parameters in braces { } are optional.

Data type returned 

text, number

Originated in 

FileMaker Pro 17.0 Advanced

Description 

Use this function to capture information provided by sensors for an iOS device running FileMaker Go. For example, you can find out the distance or number of steps traveled by a user; or the acceleration, speed, heading, and attitude for an iOS device.

Sensors

 

sensorName

Returns

Data type returned

option1

option2

Battery

 

batteryLevel

The battery charge level (from 0.0 to 1.0).

number

 

 

batteryStatus

A number representing the status of the battery charge:
1 - unplugged
2 - charging
3 - plugged in and full

number

 

 

 

 

 

 

 

Location

 

location

The current location of an iOS device in the format:

latitude (in degrees)
longitude (in degrees)
horizontal accuracy (+/- accuracy in meters)

text1

accuracy (in meters)

timeout (in seconds)

locationValues

The current location of an iOS device in the format:

latitude (in degrees)
longitude (in degrees)
altitude
(in meters)
horizontal accuracy (+/- accuracy in meters)
vertical accuracy (+/- accuracy in meters)
age (in minutes)

text1

accuracy (in meters)

timeout (in seconds)

 

 

 

 

 

Attitude, speed, and acceleration

 

attitude

The attitude for the iOS device in radians in the format:

roll
pitch
yaw

text1

 

 

rotationRate

The rotation rate of the iOS device (in radians per second) in the format:

x
y
z

text1

 

 

accelerationByUser

The acceleration the user is giving to the iOS device in meters per second squared (m/s2) in the format:

x
y
z

text1

 

 

accelerationByGravity

The gravity acceleration in meters per second squared (m/s2) in the format:

x
y
z

text1

 

 

speed

The speed of the device in meters per second.

number

accuracy (in meters)

timeout (in seconds)

heading

The current direction of movement (in degrees). It returns a value from 0.0 to 359.9 degrees.

number

accuracy (in meters)

timeout (in seconds)

 

 

 

 

 

Magnetic

 

magneticField

The magnetic field vector (in microteslas), with respect to the current attitude of the iOS device, in the format:

x
y
z

text1

 

 

compassMagneticHeading

The orientation of the user's device (in degrees) relative to magnetic north. It returns a value from 0.0 to 359.9 degrees.

number

accuracy (in meters)

timeout (in seconds)

compassTrueHeading

The orientation of the user's device (in degrees) relative to true north. It returns a value from 0.0 to 359.9 degrees.

number

accuracy (in meters)

timeout (in seconds)

 

 

 

 

 

Step counts

 

stepCount

The number of steps detected by the device for the specified duration.

number

forPastSeconds

 

stepDistance

The estimated distance (in meters) traveled by the user for the specified duration.

number

forPastSeconds

 

stepFloorsUp

The approximate number of floors ascended by the user for the specified duration.

number

forPastSeconds

 

stepFloorsDown

The approximate number of floors descended by the user for the specified duration.

number

forPastSeconds

 

 

 

 

 

 

Air pressure

 

airPressure

The recorded air pressure (in kilopascals).

number

 

 

 

 

 

 

 

List of sensors

 

available

A list of available sensorName values for the device. The values are separated by carriage returns.

text

 

 

1. The data is returned as a list of numbers separated by carriage returns.

Notes 

accuracy is a number that represents a distance in meters. The default value for accuracy is 100 meters.

timeout is a number that represents the longest time (in seconds) it will take to get the data. The default value for timeout is 10; the maximum value is 600.

The default value for forPastSeconds is the number of seconds since midnight.

FileMaker Go returns an empty string if the sensor is not available for the device.

The values for location are the same as for the Location function.

The values for locationValues are the same as for the LocationValues function.

Example 1 

GetSensor ( "stepCount"; 3600 ) returns 8000 if the user has taken 8000 steps in the past hour.

Related topics 

Functions reference (category list)

Functions reference (alphabetical list)

About functions

About formulas