Visit GitHub RepoSensors

Android Arsenal The MIT License


Android Sensor Orientation Library helps you to get more accurate vector values of orientation, using all available device sensors.


In one of my project (parallax library for android application) ,i need to use orientaion sensor values but they are too noisy so I decided to create a native library for android plateform to return these values with less noise. My purpose for sharing this code in public is to solve anybody who has this problem like me. To do this I use Accelerometer, Gyroscope, Magnetic and Orientation sensors values.


to use this library you can add codes to your project and easily use it.

Create it's object

Orientation orientationSensor = new Orientation(this.getApplicationContext(), this);

this stands for a class who implements OrientationSensorInterface class

Turn sensor ON

//------Turn Orientation sensor ON-------
// set tolerance for any directions
orientationSensor.init(1.0, 1.0, 1.0);

// set output speed and turn initialized sensor on
// 0 Normal
// 1 UI
// 2 GAME

first it must be initialized. You can set delta value for any direction you want(e.g 1.0).
you can control your sensor pooling speed when you turn your sensor on

Turn sensor OFF;

if my introduction was not completely you can see TestActivity class that i put it in this project as a library usage sample.
I hope to this library helpful for any body that use it.
I'm realy happy to people who can help me to improve this code.

Become a better Android Developer
Millions of developers are learning at MindOrks

Online Training Program

Featured Blogs

Our Team

MindOrks is Certainly one of the best online blog to stay on top of all the Android development news, coding and design patterns. Finally a blog I can count on to keep myself updated with latest and greatest things happening in Android world.

Vipul Shah
Android Developer

Become Pro in Android by watching videos