keecker / services-api

Keecker Services API
Other
5 stars 1 forks source link

Keecker Services API

This Android library allows your app to access Keecker features. It provides a low-level access to sensors and movement, as well as higher-level information:

Getting Started

Prerequisites

Add the library in your Android app

  1. Add the JitPack repository in your root build.gradle at the end of repositories.

       allprojects {
           repositories {
               ...
               maven { url 'https://jitpack.io' }
           }
       }
  2. Add the dependency, replace Tag by the latest version: JitPack.

        dependencies {
            implementation 'com.github.keecker:services-api:Tag'
        }

Use the Keecker Services

In your main AndroidManifest.xml, add the following permission to be allowed to move the projector:

<manifest>
    ....
    <uses-permission android:name="com.keecker.permission.PROJECTION" />

Add the code that will actually move the projector in your activity:

fun wobbleProjector() {
    val projector = KeeckerServices.getProjectorClient(applicationContext)
    GlobalScope.launch(Dispatchers.IO) {
        while (true) {
            projector.setState(ProjectorState(orientation = 0))
            delay(5000)
            projector.setState(ProjectorState(orientation = 90))
        }
    }
}

At the moment you can use the following clients:

Building

This is not needed to use the library, add it to your project as described above. However, you may be interested to run some of the tests that show how Android handles IPC and permissions.

You need a working Android development environment to compile this library. Follow the instructions on the official website.

Compiling

Generate the library.

./gradlew assembleRelease

Unit test

Unit tests specify and test the logic behind API Clients.

./gradlew test

Then check the report in build/reports/tests

Android tests

Android tests show how Android handles IPC and permissions, and what to expect from it. You will need a plugged Android device or emulator to run those tests.

./gradlew connectedAndroidTest

Then check the report in build/reports/tests

Coding-style tests

Coding style is not yet tested, we follow the Google coding styles:

License

Licensed under the Apache License, Version 2.0 - see the LICENSE.md file for details.