From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Class (inherits from MobileControl)

New in 2020r2

Provides motion updates from the device.

Shared Properties
GravityAccelerationX fa-lock-32.png Roll fa-lock-32.png UserAccelerationX fa-lock-32.png
GravityAccelerationY fa-lock-32.png RotationRateX fa-lock-32.png UserAccelerationY fa-lock-32.png
GravityAccelerationZ fa-lock-32.png RotationRateY fa-lock-32.png UserAccelerationZ fa-lock-32.png
Handle fa-lock-32.png RotationRateZ fa-lock-32.png Yaw fa-lock-32.png
Pitch fa-lock-32.png UpdateInterval
Shared Methods
Start Stop


On iOS motion updates include both the accelerometer and gyroscope.

Only one MobileMotion object can be created per application for performance reasons. You cannot create a new MobileMotion instance using "New MobileMotion".

You can check and compare the property values at specific points in your code or regularly using a Timer. To save on battery, you should disable motion detection when it is not needed.

The motion properties return real values only after the Start method has been called. If Start has not been called or Stop has been called, they return 0.

The iOS Simulator does not provide motion data, so you will need to test on an app running on an actual device to see how these property values change.