MotionDistributor

class MotionDistributor(context: Context, dispatcher: CoroutineDispatcher = Dispatchers.Main)

This class is responsible for distributing motion events to listeners. It listens for motion events from the MotionManager and notifies the listeners.

Parameters

context

The context of the application

dispatcher

The dispatcher that is used to listen on

Constructors

Link copied to clipboard
constructor(context: Context, dispatcher: CoroutineDispatcher = Dispatchers.Main)

Properties

Link copied to clipboard
val motionData: StateFlow<DeviceMotion?>

Notifies consumers of the motionData of changes when the data changes.

Functions

Link copied to clipboard

This method starts listening for motion events from the MotionManager and notifies the listeners when they occur.

Link copied to clipboard

This method stops listening for motion events from the MotionManager. This should be called when the MotionDistributor is no longer needed.