Git Product home page Git Product logo

android-orientation-sensor's Introduction

Android Arsenal The MIT License

Android-Orientation-Sensor

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

Overview

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.

Usage

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
// 3 FASTEST
orientationSensor.on(0);

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

orientationSensor.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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.