RotationMonitor

open class RotationMonitor

Rotation monitor can be use watch for device rotation changes. It uses TYPE_ROTATION_VECTOR sensor if available to detect device rotation changes. If the sensor is not available then the rotation monitor will attempt use the sensors TYPE_ACCELEROMETER, TYPE_GYROSCOPE and TYPE_MAGNETIC_FIELD to detect the rotation changes.

Constructors

Link copied to clipboard
constructor(context: Context)
Constructs a new rotation monitor for the given context.

Types

Link copied to clipboard
interface Listener
Defines the contract of listener that can receive notifications about device rotation changes.

Properties

Link copied to clipboard
Reference to the listener that must be notified when an rotation change is detected.

Functions

Link copied to clipboard
open fun getRotation(): Int
Returns the rotation of the screen from its "natural" rotation.
Link copied to clipboard
open fun startTracking()
Starts the rotation monitor to start tracking for device rotation changes.
Link copied to clipboard
open fun stopTracking()
Stops the rotation monitor.