Skip to content

Developing with the SDK

Two libraries are included in the SDK: the core library and the support library. The core library provides low-level access to the Iristick smart glasses. The support library is a thin layer on top of the core library providing easy management of Iristick smart glasses and reducing boilerplate code. Hence, it is recommended to use the support library in most cases. This page will detail the use of the support library.

Adding the support library to a project

First, add the following dependencies to your project:

dependencies {
    implementation 'com.iristick.smartglass:core:1.3.4'
    implementation 'com.iristick.smartglass:support:1.3.4'

Next, create an Android Application subclass, and add the following code in the onCreate() method. If you already have an Application subclass, just add the IristickApp.init call in your onCreate() method. It is important that the init method has been called before any other use of the libraries.

public class MyApplication extends Application {
    public void onCreate() {


The behavior of the SDK can be customized by passing an IristickConfiguration object as second parameter to IristickApp.init.

Make sure the application is registered in the manifest by setting the android:name attribute of the <application> tag to the name of your Application subclass.

At last, add the following method to all activities in your project. The easiest way to do so is to create an abstract base class extending Activity and let all your project's activities inherit from it.

protected void attachBaseContext(Context newBase) {

Designing apps for the Iristick smart glasses

By default, the heads-up display on the Iristick smart glasses mirrors the content of the phone screen. When the user is interacting with the smart glasses through the touchpad or through voice, the display is adapted to optimize for the heads-up display:

  • Landscape orientation is forced,
  • The notouch variants of resources are used (if available),
  • The phone touchscreen is locked.

The above optimizations are also applied when the phone is buried away in a pocket or a pouch. To disable this behavior, uncheck Detect Pouch in the Iristick Services settings.

To provide an alternative layout to be used when the smartphone screen is not visible, add a new resource in Android Studio. In the New Resource File dialog, select the Touch Screen qualifier with value No Touch.

Whenever a headset is attached or detached, or when the interaction mode changes, your activities will be recreated, as if a configuration change has occurred. You can override this behavior in the IristickConfiguration object passed to IristickApp.init().

Designing custom UI for the heads-up display

If cloning the phone display on the heads-up display is not desired, you can also provide a fully custom UI for the heads-up display that is independent of the phone UI.

Subclass the HudPresentation class to provide the custom UI to show on the heads-up display. Next, implement the HudActivity interface on each activity for which you want to provide custom UI, and provide an instance of your HudPresentation subclass.

class MyHud extends HudPresentation {
    private TextView mText;

    MyHud(@NonNull Context outerContext, @NonNull Display display) {
        super(outerContext, display);

    protected void onCreate(@Nullable Bundle savedInstanceState) {

        /* Set layout. */

        /* Get widgets defined in the layout. */
        mText = findViewById(;

    public boolean onTouchEvent(@NonNull TouchEvent event) {
        /* Handle incoming touch events */
        switch (event.getGestureCode()) {
        case TouchEvent.GESTURE_TAP:
            return true;
            return false;

Accessing smart glasses features

To get access to all the features on the Iristick smart glasses, call IristickApp.getHeadset(). This will return a Headset object or null if no smart glasses are currently connected. The Headset object represents the attached smart glasses and is the entry point to all functionality. When a headset gets attached or detached, the activity will be recreated so that you can act upon the change. If you need access to the attached smart glasses outside of an activity, you can register a listener with IristickApp.registerConnectionListener.

  • Microphones and speaker are fully integrated in the Android platform and are automatically used whenever Iristick smart glasses are attached. Use the standard Android audio APIs.

  • To directly draw on the display, bypassing the integration described above, either request a Display object through Headset.openDisplay(), or a Surface object through Headset.openDisplaySurface(). Using the former method, any Android UI elements can be drawn by subclassing the Presentation class. Using the latter method, a frame can be drawn manually by calling Surface.lockCanvas().

  • Cameras are accessible via the camera package of this SDK, which provides an API similar to the android.hardware.camera2 API.

  • Touchpad events are received by registering an implementation of TouchEvent.Callback.

  • Sensors (such as accelerometer, gyroscope and magnetometer) can be queried with Headset.getSensorList(type). Register a listener to enable a sensor and receive measurements.

  • Voice commands are discovered from the properties of clickable elements shown on screen. This behavior can be customized and additional commands can be provided through the API.