AndroidOrientationProvider

class AndroidOrientationProvider(context: Context, updateInterval: Duration, coroutineScope: CoroutineScope, sharingStarted: SharingStarted = SharingStarted.WhileSubscribed(stopTimeoutMillis = 1000)) : OrientationProvider(source)

An OrientationProvider built on Android's SensorManager.

It maps the azimuth from a rotation-vector sensor to Orientation.orientation, and the sensor's estimated heading accuracy to BearingWithAccuracy.accuracy. A sensor that reports its accuracy as unavailable maps to a null accuracy.

Parameters

context

Context used to obtain the platform sensor manager.

updateInterval

Preferred minimum time between delivered headings.

coroutineScope

Scope used to share the orientation flow.

sharingStarted

Sharing policy for the orientation flow.

Constructors

Link copied to clipboard
constructor(context: Context, updateInterval: Duration, coroutineScope: CoroutineScope, sharingStarted: SharingStarted = SharingStarted.WhileSubscribed(stopTimeoutMillis = 1000))

Properties

Link copied to clipboard
open override val orientation: StateFlow<Orientation?>

The latest heading, or null before one is available.