/sensor-accelerometer-multiplatform

Kotlin Multiplatform Mobile Accelerometer Sensors Library

Primary LanguageKotlin

Kotlin Mobile Multiplatform Accelerometer Sensors Library

This library allows you to get a Flow from your Android or iOS (only on main thread) data from accelerometers.

Application exposes a custom model SensorData that exposes:

  • heading calculated in degrees
  • sensor as AccelerometerData
  • gravity as optional AccelerometerData
data class SensorData(
    val heading: Double,
    val sensor: AccelerometerData,
    val gravity: AccelerometerData? = null
)

Each AccelerometerData has this structure:

data class AccelerometerData(val x: Double, val y: Double, val z: Double)

Supported Platforms

  • iOS
  • Android

Installing

Usage

For usage you can refer to the two examples you can find in iOSApp and AndroidApp.

Local release

./gradlew publishMavenLocal