SensorBox - record all your sensors to csv files
The SensorBox provides easy way to access sensors in Android phone and Wear Os. You can customize measurements in many ways, which is suitable for development of other apps. The outputs of the app are raw outputs of the system.
Features:
Whole functionality is hidden under SensorServices library, where one foreground service operates with sensors, GPS and other APIs.
- stores sensor outputs into the csv: timestamp, values, accuracy
- values from the sensors are in raw format - no resampling
- pick native sensor speed limits
- compatible with GPS
- can use Activity recognition API from Android and Significant motion sensor
- write custom annotation during measurement
- all extra information are stored in JSON
- check sensor attributes and preview of the outputs
- measurement can be customized :
- write own key words to measurement
- set up timed alarms
- set up countdown to start measurement
- stop on low battery measurement
- lock CPU, add app to whitelist
- compatible with Wear Os with similar features
Organization of code and the libraries:
Code
- whole code is in Kotlin (Flipper - third party - code is in Java)
- the phone app follows MVI architecture - activity/fragment -> ViewModel -> repository
- There are 2 activities created with this architecture :
- MainActivity - created with other fragments like HomeFragment, AdvancedFragment, SettingsFragment, ... - these fragments share one ViewModel defined by MainActivity. Meanwhile for the navigation is used androidx fragment navigation library.
- MeasurementActivity - alone activity to create annotations / stop the measurement if it is proceeding - has its own ViewModel
- In the phone application is used Hilt - dependency injection library
- The phone app and the Wear Os app use the same SensorService Library which covers all the requirements from the apps. The library provides intents builders for both of them.
- WearOsLib provides easy and comprehensive code of how to find other device and send messages, send file between them.
Libraries:
- app / wear - implementation for the phone / wearable respectively
- CountDownDialog - library for creation of the countdowns, with interaface to interact and custom Dialog
- Flipper - Storage access framework created by baldapps
- Sensorservices - main background service, which registers all the sensors and other providers of the data
- WearOsLib - general library for communication of the phone and wearable and vice versa
How to build the project:
- clone / download the project to your machine
- to activate google services follow steps at Firebase. Create project and get the
google-services.json
- make sure, that the package id in app/wear build gradle is the same as in firebase console
google-services.json
copy to the app folder and wear folder too
- to activate Google maps, follow the steps here to create API key Google documentation
- adding line to
local.properties
: MAPS_API_KEY=YOUR_API_KEY is enough
Third parties:
Thanks goes to: