Android library for monitoring hardware sensors with RxJava Observables.
ReactiveSensors is an Android library that provides reactive programming interfaces for monitoring device hardware sensors. It wraps Android's SensorManager API into RxJava observables, allowing developers to handle sensor data streams with familiar reactive operators. The library solves the problem of imperative and callback-heavy sensor programming by offering a declarative, composable approach to sensor data processing.
Android developers building applications that require hardware sensor integration, such as fitness trackers, augmented reality apps, games, or motion-based utilities. It's particularly useful for developers already using RxJava in their Android projects.
Developers choose ReactiveSensors because it simplifies sensor programming with reactive patterns, reduces boilerplate code, and provides better testability through its proxy interface. Unlike manual SensorManager implementations, it offers built-in backpressure handling, filtering capabilities, and seamless integration with RxJava's rich operator ecosystem.
Android library monitoring device hardware sensors with RxJava
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Wraps Android SensorManager into RxJava Flowables, enabling declarative composition and transformation of sensor data streams, as demonstrated in the README's gyroscope monitoring example.
Allows setting sampling periods using Android's predefined delays (e.g., SENSOR_DELAY_GAME) or custom microsecond values, providing flexibility for optimizing sensor data frequency based on application needs.
Includes a SensorsProxy interface that facilitates mocking and stubbing in unit tests without requiring hardware access, making sensor logic easily testable, as highlighted in the 'Writing tests' section.
Provides methods to check sensor availability before observing and filter events for sensor changes or accuracy updates, reducing runtime errors and simplifying error management in reactive streams.
The library is tightly coupled to RxJava, making it unsuitable for projects using other reactive frameworks like Kotlin Coroutines Flow and adding unnecessary overhead if reactive patterns aren't required.
With separate branches for RxJava 1.x, 2.x, and 3.x, developers must carefully choose the correct version, leading to potential compatibility issues and fragmented maintenance, as noted in the README's branch table.
The reactive abstraction layer may introduce latency compared to direct SensorManager callbacks, especially for high-frequency sensors where real-time performance is critical, despite configurable sampling periods.