FileMaker 17 introduced the new GetSensor function as a new mobile function available for use in FileMaker Go apps. With this new function, you can gather sensor data from an iOS device and use it programmatically in your custom app.

While this is a good start, there’s still some device metadata and sensor data that is not available from the function. A few years ago, I released a metadata gathering app, CoreScope, that allows for more information to be gathered from the device. Due to my familiarity with iOS programming and sensors, I found some parts of FileMaker’s documentation on this function to be a little confusing. So, I dug deeper into Apple’s developer documentation to put together the below chart explaining in detail what each sensor reading represents.

Use these helpful tables in order to understand and use sensors with the GetSensor() function.

Configuration

Parameter nameDescriptionExample usageExample result
availableReturns a list of which sensors are available for use on the current device.GetSensor(“available”)Battery
Magnetic
Step count

Battery sensor

Parameter nameDescriptionExample usageExample result
batteryLevelReturns a decimal representing the battery charge level between 0.0 and 1.0GetSensor(“batteryLevel”).76
batteryStatusReturns the power charging status for result; EG if a device is unplugged or not.GetSensor(“batteryStatus”)1

1 = unplugged, 2 = charging, 3 = plugged in and full

Location sensor

(Note that if the optional accuracy and timeout parameters are not specified, a default accuracy of 100 meters and 10 seconds is used.)

Parameter nameDescriptionExample usageExample result
locationThe same as the existing Location() function. Returns latitude, longitude, horizontal accuracy.GetSensor(“location”;50;10)

50 = Accuracy
10 = Timeout in Seconds
+37.343123, -122.017593, +65.000000
locationValuesThe same as the existing LocationValues() function. Returns latitude, longitude, altitude, horizontal accuracy, vertical accuracy, age.GetSensor(“locationValues”;50;10)

50 = Accuracy
10 = Timeout in Seconds
37.406489
-121.983428
0.0545050
65
10
0.001236

Attitude, speed & acceleration sensor

(Note that if the optional accuracy and timeout parameters are not specified, a default accuracy of 100 meters and 10 seconds is used.)

Parameter nameDescriptionExample usageExample result
attituderoll, pitch, yaw in radiansGetSensor(“attitude”)2
1
4
rotationRatex, y, z measured in radians per secondGetSensor(“rotationRate”).1
.4
0
accelerationByUserx, y, z values for acceleration by user in respect to the current attitude in meters/seconds2GetSensor(“accelerationByUser”)23
1
3
accelerationByGravityx, y, z values for acceleration by gravity with respect to current attitude in meters/seconds2GetSensor(“accelerationByGravity”).8
.01
.2
speedReturns the current speed at the time of reading in meters per second.GetSensor(“speed”;50;10)

50 = Accuracy
10 = Timeout in Seconds
1.2
headingReturns the current direction of movement in degrees (0.0 - 359.9).GetSensor(“heading”;50;10)

50 = Accuracy
10 = Timeout in Seconds
254.8

Magnetic sensor

(Note that if the optional accuracy and timeout parameters are not specified, a default accuracy of 100 meters and 10 seconds is used.)

Parameter nameDescriptionExample usageExample result
magneticFieldThe geomagnetic data (measured in microteslas) for the x, y and z-axis.GetSensor("magneticField")30
24
60
compassMagneticHeadingdegrees (0.0 - 359.9) between magnetic north and current attitudeGetSensor("compassMagneticHeading";50;10)

50 = Accuracy
10 = Timeout in Seconds
104.8
compassTrueHeadingdegrees (0.0 - 359.9) between true north and current attitudeGetSensor("compassTrueHeading";50;10)
50 = Accuracy
10 = Timeout in Seconds
100.8

Step count sensor

(Note that if the optional second parameter is not specified, it returns the values measured since midnight of the current day. The sensor can be inaccurate if the user has not calibrated their phone’s step settings inside of health data and motion calibration. Also, returned measurements may be localized to the user’s iOS localization settings, eg. meters vs. feet.)

Parameter nameDescriptionExample usageExample result
stepCountReturns the number of steps taken in the past specified seconds value, or from midnight if no number is specified.GetSensor(“stepCount”)
GetSensor(“stepCount”;10)
4000
3
stepDistanceMeasure of distance while walking during the specified time elapsed (or midnight by default). GetSensor(“stepDistance”)
GetSensor(“stepDistance”;10)
2400
4
stepFloorsUpMeasured in number of floors, the number ascended in the last specified seconds (or default of midnight). GetSensor(“stepFloorsUp”)
GetSensor(“stepFloorsUp”;1000)
22
5
stepFloorsDownThe number of floors descended since seconds specified or midnight (default). GetSensor(“stepFloorsDown”)
GetSensor(“stepFloorsDown”;300)
15
3

Air pressure sensor

Parameter nameDescriptionExample usageExample result
airPressureReturns air pressure as measured in kilopascalsGetSensor(“airPressure”)101.325