Git Product home page Git Product logo

nuimo-android's Introduction

The Nuimo controller is an intuitive controller for your computer and connected smart devices. The Nuimo Android SDK helps you to easily integrate your Android apps with Nuimo controllers.

Installation

Android project requirements

Your Android project must target at least API level 18. Earlier Android versions didn't support Bluetooth Low Energy. So make sure that minSdkVersion is set at least to 18 or higher in your build.gradle file.

Gradle dependency for the Nuimo library

The Nuimo SDK library for Android is available via the jCenter repository. To include the Nuimo library in your Android app dependencies you need to add two dependency lines to your build.gradle:

dependencies {
    ...
    compile "com.senic:nuimo-android:0.2.0"
    compile "org.jetbrains.kotlin:kotlin-stdlib:1.0.0-beta-3595"
}

If you're wondering why kotlin-stdlib is needed: The Nuimo library is written in the Kotlin programming language instead of Java. If you are already writing your Android apps in Kotlin then there's no need for this extra line.

Usage

Basic usage

The Nuimo library makes it very easy to connect your Android apps with Nuimo controllers. It only takes three steps and a very few lines of code to discover your Nuimo and receive gesture events:

  1. Add a NuimoDiscoveryListener to an instance of NuimoDiscoveryManager and call startDiscovery(). This will discover Nuimo controllers nearby.

  2. Receive discovered controllers by implementing the listener method onDiscoverNuimoController. Here you can

    1. Add an event listener to the discovered controller
    2. Initiate the Bluetooth connection to the discovered controller by calling connect()
  3. Implement NuimoControllerListener's event method onGestureEvent to access user events performed with the Nuimo controller.

The following code example demonstrates how to discover, connect and receive gesture events from your Nuimo.

Example code
public class MainActivity extends AppCompatActivity implements NuimoDiscoveryListener {
    NuimoDiscoveryManager nuimoDiscovery = new NuimoDiscoveryManager(this);

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        nuimoDiscovery.addDiscoveryListener(this);
        nuimoDiscovery.startDiscovery();
    }

    @Override
    public void onDiscoverNuimoController(@NotNull NuimoController nuimoController) {
        nuimoDiscovery.stopDiscovery();
        nuimoController.addControllerListener(new NuimoListener());
        nuimoController.connect();
    }

    class NuimoListener extends BaseNuimoControllerListener {
        @Override
        public void onGestureEvent(@NotNull NuimoGestureEvent event) {
            System.out.println("Received event: " + event.getGesture() + ": " + event.getValue());
        }
    }
}
A ready to checkout Android demo appl

We've provided a ready to checkout Android app that demonstrates discovering, connecting and receiving events from your Nuimo controllers. It also demonstrates how display fancy icons on its LED matrix. Simply clone the Nuimo Android demo repository and open it in Android Studio.

Advanced usage

The Nuimo library for Android is much more powerful than the use cases presented above. More details to follow here soon.

Contact & Support

Have questions or suggestions? Drop us a mail at [email protected]. We'll be happy to hear from you.

License

The NuimoSwift source code is available under the MIT License.

nuimo-android's People

Contributors

larsblumberg avatar

Watchers

ligi avatar James Cloos avatar  avatar

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.