Skip to content

keecker/services-api

Repository files navigation

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:

  • Front and 360 cameras
  • Depth camera and proximity sensors
  • Movement commands and location on the map
  • Wall and charging station detection

Getting Started

Prerequisites

  • You will need Android Studio, check the install instructions on the official website.
  • You may want to check "Build your first app" on the Android developer website.
  • Create a new Android TV app, preferably using the Kotlin language.

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:

  • ProjectorClient, requiring the com.keecker.permission.PROJECTION permission.
  • PerceptionClient, requiring the com.keecker.permission.PERCEPTION permission.
  • MovementClient, requiring the com.keecker.permission.MOVEMENT permission.

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.