Skip to content

A small library that wraps orientation sensors listeners into RxJava2

Notifications You must be signed in to change notification settings

hichamboushaba/ReactiveCompass

Repository files navigation

ReactiveCompass

A small library that wraps orientation sensors listeners into RxJava2 observables

To use:

val compass = Compass(this)
compass.observeAzimuth()
       .distinctUntilChanged({ i1, i2 -> Math.abs(i1 - i2) < 1 })
       .subscribe { println("Azimuth: ${it.toInt()}") }
compass.observeAccuracy()
        .distinctUntilChanged()
        .map {
            when (it) {
                        ICompass.Accuracy.ACCURATE -> "Accurate"
                        ICompass.Accuracy.MEDIUM -> "Medium"
                        ICompass.Accuracy.NOT_ACCURATE -> "Inaccurate"
                      }
              }
         .subscribe { println("Accuracy: $it") }

About

A small library that wraps orientation sensors listeners into RxJava2

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published