X2 Software Developer Guide
X2 Software Developer Guide
Overview
Welcome to the ThirdEye Gen X2 Software Developer Guide. This document contains important
information to guide you in the development of apps for the X2 Mixed-Reality smart glasses.
Please read through this guide carefully before beginning app development.
The X2 utilizes the Android operating system (ver. 8.1/9.0 (API Level 27/28)) and does not
require any additional SDKs or 3rd party libraries for the development of compatible apps. This
guide assumes that you possess a working knowledge of the Java programming language, and
the Android Software Development Kit. You can reference the official Android Software
Developer Guides to learn the basics of developing apps for the Android platform. All
references to Integrated Development Environment (IDE) settings are based on Android Studio.
You can download the latest version of Android Studio here. All code samples in this guide are
provided in Java. However, apps written in Kotlin are fully compatible with the X2.
This guide will provide you with information on the specific differences involved in developing for
the X2 platform, and how to enhance the user experience by optimizing your app for the X2’s
heads-up display and advanced User Interface. For additional assistance, please contact our
support team at [email protected].
*Important Note: The X2 is not compatible with Google Play or associated Google Mobile
Services (GMS). If your app requires connection to GMS-based services (ARCore, Firebase,
Google Translate, Google Speech Recognition, etc), it will not be able to access those
resources while running on the X2.
Quick Start Guide
IDE Settings
To ensure compatibility, and to improve the accuracy of the screen previews provided in
Android Studio, use the following settings/parameters while developing your app for the X2.
In your app module’s build.gradle file, set “compileSdkVersion” to “28, set “minSdkVersion” to
“27”, and set “targetSdkVersion” to “28”.
When utilizing the layout preview window in Android Studio, use the following settings:
Before requesting the audio input device, use the following code to temporarily stop the Speech
Recognizer:
intent.putExtra("instructions", "interrupt");
sendBroadcast(intent);
In order to ensure that the audio input device is completely released, it is recommended that
you wait a short time (1-2 seconds) between calling “interrupt” on the Speech Recognizer
service and requesting the audio input device from Android. This can be done by using a
Countdown Timer, or by calling “Sleep” on your thread. Failure to insert a delay can result in
your app not receiving audio input after completing the request.
When finished using the audio input device, use the following code to restart the Speech
Recognizer:
intent.putExtra("instructions", "resume");
sendBroadcast(intent);
The Speech Recognizer will display a toast after receiving each intent. The speech recognizer
will remember its previous state, and will return to the same mode/command list from before it
was stopped.
To minimize the ThirdEye UI Controls menu bar, use the following code:
To restore the menu when you no longer require it to be hidden, or when your application
closes, use the following code:
For many use cases (code scanning, object detection, SLAM-based experiences, etc.), it is best
to maintain a clear view of the real world while utilizing the camera(s) for long periods of time.
As detailed previously in this guide, you can use a black background to allow the user to see
through the display into the real world. Doing this while simultaneously maintaining the required
“Camera Preview” view requires a slightly more complicated approach. The following example is
just one approach to achieving optical see-through while utilizing the camera(s).
In this example, we will be using the “TextureView” view as the view for the Camera preview,
with an additional ImageView of the same size containing a black background. When the
ImageView is set to be visible, it will sit in front of the camera preview, resulting in a black, see
through background for the entire screen. You can then place other GUI elements in front of this
child view for user to see/interact with.
<RelativeLayout
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_margin="5dp">
<TextureView
android:id="@+id/textureview"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"/>
</RelativeLayout>
</android.support.constraint.ConstraintLayout>