Version 34 (modified by xianyi, 7 years ago) (diff)


Android Sensor Library

JPG Logo

Current Team

Student Researchers

  • Gradeigh D. Clark [gradeighdclark (AT) gmail (DOT) com]
  • Xianyi Gao [xianyigmsn (AT) hotmail (DOT) com]
  • Malathi Dharmalingam [dharmalingam (DOT) malathi (AT) gmail (DOT) com]
  • Theophilius Mensah [aimthesun (AT) yahoo (DOT) com]

Project Advisors

  • Ivan Seskar [sekar (AT) winlab (DOT) rutgers (DOT) edu]
  • Marco Gruteser [gruteser (AT) winlab (DOT) rutgers (DOT) edu]
  • Janne Lindqvist [janne (AT) winlab (DOT) rutgers (DOT) edu]
  • Kiran Nagaraja [nkiran (AT) winlab (DOT) rutgers (DOT) edu]


The goal of this summer project is to develop a library to more freely manipulate the sensors on Android devices. If a simple, usable library exists for sensor manipulation on Android devices then development of applications to use and analyze sensor data could be accelerated enormously. There is a considerable investment of time required as of now in regards to how much an individual needs to learn about gathering Android sensor data prior to actually using it -- it is our hope that with this project, developers can bypass these beginning steps and start the task of actually developing applications with their data rather than spending time to obtain it.
In the long term, there exists a hope that the project will blossom into a general open-source sensor library where any individual regardless of creed and affiliation who wish to contribute to the library can do so without impedance.


The library was written using Eclipse with the Android plugin tools. To use the library and add onto it, it is recommended to use Eclipse in the same fashion.

Current Progress


To begin, the latest version of project's code can be viewed here, on the project's github page.

Currently, a very simple version library has been constructed revolving around sensors controlled by the Android SensorManager class with two additional sensors: the microphone and the GPS.

The current sensors that the application is capable of supporting are:

Sensor Name SensorManager Sensor
Ambient TemperatureYes
Linear AccelerationYes
Magnetic FieldYes
Relative HumidityYes
Rotation VectorYes

Although sensors like Relative Humidity, Temperature, and Pressure (to name a few) have existing support in Android, that is not to say there are many (any?) devices out there that actually have these sensors built into them.

The majority of the sensors (that is to say, the ones controlled by SensorManager) have only one parameter that needs to be specified for their usage-- update rate (in ms). Setting the update rate means setting how often Android polls the data from selected sensors and examines to see what it is. Based upon the result, the sensor library (as currently configured)

Supported Functionality

  • Can determine which sensors are available on the device
  • Can specify individual update rates for all SensorManager sensors
  • Can use predefined sampling rates for microphone, GPS
  • Specific events can be marked during logging, allowing a user to tag the data
  • A specific snapshot of data can be taken over a user controlled time interval during logging
  • Microphone & GPS can be constructed with user controlled characteristics (Encoding, channel, etc.)

Sensor data can be logged in three different ways:

  • Writing sensor data to a file
  • Writing sensor data to an SQLite database
  • Uploading sensor data to a server

The first two are fully implemented; the third one is expected to be implemented pending completion of a robust file upload method for the files.

SensorAdventure Application

The SensorAdventure application is a testing bed for the library.

Main GUI Screen Start GUI

The first image is the main GUI screen for the application. If the phone lacks certain sensors, they will appear with red text and have their CheckBox text switched to "NA". Additionally, the view containing the update rate value is not clickable. The three buttons at the bottom of the screen are the only other way to interact with the application:

  • Start Logging will begin the services that log sensor data; this is the last image
  • Save will save the current settings of the application into a file that the application checks for in onCreate. Currently it saves the update rate information, which sensors are on, and the data configuration settings
  • Data Configuration button will take the user to the third image

Certain sensors require more advanced configurations other than update rate & sampling rate. As such, there exists an advanced settings GUI that is accessible through the menu button on Android devices.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Attachments (15)

Download all attachments as: .zip