Class

MobileMotion


Description

Provides motion updates from the device.

Methods

Name

Parameters

Returns

Shared

Handle

Ptr

Start

Stop

Events

Name

Parameters

Returns

Closing

Opening

Property descriptions


MobileMotion.GravityAccelerationX

GravityAccelerationX As Double

The X-axis gravity acceleration. Gravity-caused acceleration is constantly downward, and could be used to present something as always "right side up" or other things relating to the ground position.

This property is read-only.

This property is shared.


MobileMotion.GravityAccelerationY

GravityAccelerationY As Double

The Y-axis gravity acceleration. Gravity-caused acceleration is constantly downward, and could be used to present something as always "right side up" or other things relating to the ground position.

This property is read-only.

This property is shared.


MobileMotion.GravityAccelerationZ

GravityAccelerationZ As Double

The Z-axis gravity acceleration. Gravity-caused acceleration is constantly downward, and could be used to present something as always "right side up" or other things relating to the ground position.

This property is read-only.

This property is shared.


MobileMotion.Name

Name As String

The name of the control.

This property is read-only.


MobileMotion.Pitch

Pitch As Double

A pitch is a rotational position around a lateral axis that passes through the device from side to side.

This property is read-only.

This property is shared.


MobileMotion.Roll

Roll As Double

A roll is a rotational position around a longitudinal axis that passes through the device from its top to bottom.

This property is read-only.

This property is shared.


MobileMotion.RotationRateX

RotationRateX As Double

The X-axis rotation rate in radians per second.

This property is read-only.

This property is shared.


MobileMotion.RotationRateY

RotationRateY As Double

The Y-axis rotation rate in radians per second.

This property is read-only.

This property is shared.


MobileMotion.RotationRateZ

RotationRateZ As Double

The Z-axis rotation rate in radians per second.

This property is read-only.

This property is shared.


MobileMotion.UpdateInterval

UpdateInterval As Integer

Set to change how often (in milliseconds) the app should receive updates from the sensors.

This property is shared.

Shorter intervals result in increased battery usage.


MobileMotion.UserAccelerationX

UserAccelerationX As Double

The X-axis user-caused acceleration. User-caused acceleration could be used for detecting things like shakes and other purposeful movement in space.

This property is read-only.

This property is shared.


MobileMotion.UserAccelerationY

UserAccelerationY As Double

The Y-axis user-caused acceleration. User-caused acceleration could be used for detecting things like shakes and other purposeful movement in space.

This property is read-only.

This property is shared.


MobileMotion.UserAccelerationZ

UserAccelerationZ As Double

The Z-axis user-caused acceleration. User-caused acceleration could be used for detecting things like shakes and other purposeful movement in space.

This property is read-only.

This property is shared.


MobileMotion.Yaw

Yaw As Double

A yaw is a rotational position around an axis that runs vertically through the device. It is perpendicular to the body of the device, with its origin at the center of gravity and directed toward the bottom of the device.

This property is read-only.

This property is shared.

Method descriptions


MobileMotion.Handle

Handle As Ptr

The handle to the underlying native OS control.

Important

This method is supported for iOS only.


MobileMotion.Start

Start

Start receiving updates from the motion sensors.

This method is shared.


MobileMotion.Stop

Stop

Stop receiving updates from the motion sensors.

This method is shared.

Event descriptions


MobileMotion.Closing

Closing

Called when the control's layout is closing.


MobileMotion.Opening

Opening

Called when the control's layout is opening.

This is where you typically put initialization code.

This example in the Opening event of a label sets its text to "Hello":

Me.Text = "Hello"

Notes

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.

Note

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.

Compatibility

Mobile projects on all supported mobile operating systems.