MOVERIO
BT-30C Documentation

2. Developing Android Apps

2.1. Summary of Developing Android Apps

The following describes the steps necessary to develop an Android app for Moverio.

Introduction to the Android SDK

Including the Moverio SDK

API Reference

Range of Uses for Moverio SDK

2.1.1 Introduction to the Android SDK

The introduction to the Android SDK assumes the following steps will be performed in a Windows 10 environment.

2.1.1.1 Acquiring Android Studio

Download Android Studio from the following website. (Android Studio 3.1.4 as of August 2018)
https://developer.android.com/studio/

2.1.1.2 Installing Android Studio

Follow the directions provided by the installer to install Android Studio.

Example) C:\Users\<user name>name\AppData\Local\Android\sdk
* From here on, instructions assume Android Studio is installed in the folder above.

2.1.1.3 Proxy Settings for Android Studio

If you are developing an app in a network environment that requires proxy settings, make sure you make proxy settings for Android Studio. See the following website for details on the procedures.
https://developer.android.com/studio/intro/studio-config#gradle-plugin
If you do not know the proxy settings, contact your network administrator for information on how to connect to an external network using proxy settings.

2.1.1.4 Acquiring/Updating Tools in Android SDK Manager

Make sure you use the Android SDK Manager to acquire the tools necessary for app development. See the following website for details on the procedures.
https://developer.android.com/studio/intro/update#sdk-manager

2.1.2 USB Driver Settings

You need to setup the USB driver for your host device to connect to the app development computer. To setup your USB driver, check the setup instructions for your host device.

2.1.3 Connecting the Host Device and Computer

This section explains how to connect the computer and the host device after you have finished making ADB settings.

2.1.3.1 Settings for the Host Device

Enable the developer option for the host device. Next, enable USB debugging. See the following website for details on the procedures.
https://developer.android.com/studio/debug/dev-options

2.1.3.2 Checking the Connection

You can check if the computer and the host device are connected by using the ADB connection check command.
Start the command prompt, run "cd C:\Users\<user name>\AppData\Local\Android\sdk\platform-tools",
and move the folder.
* It is useful to maintain the environment variable path mentioned above.

When you execute "adb devices" and the device name is displayed in the list, ADB connection is complete.

* If this is not displayed, reconnect the host device to the USB port, and rerun the "adb devices" command.

2.1.4 Including the Moverio SDK

The following procedures assume app development in Android Studios.

Display the Project View in Android Studio, and then create a "libs" folder from [File]-[New]-[Directory].
C:\Users\<user name>\AndroidStudioProjects\<application name>\app\libs is created; put MoverioSDK.aar in this folder.
(When the created project folder is C:\Users\<user name>\AndroidStudioProjects)
* Explanations from now on are based on the assumption that the project is at C:\Users\<user name>\AndroidStudioProjects\<application name>.
Next, the minimum API level of the application is defined as 24, add MoverioSDK.aar to your application's dependencies.

apply plugin:  'com.android.application'

android {
        :
    // Add API level 24
    minSdkVersion 24
        :
}

dependencies {
        :
    // Add MoverioSDK.aar
    implementation files('libs/MoverioSDK_1.0.0.aar')
        :
        :
}

Press the Sync Project with Gradle Files button above Android Studio to apply the Gradle change to the project.

2.2. Display Management

The Moverio has a see-through (transparent) display. The Moverio SDK allows you to manage the brightness of the display and switch between 2D/3D display mode. You can adjust the brightness of the display by using the dedicated API and by using the auto adjust method according to the brightness of the surroundings. The Side-by-Side method for displaying 3D content is also supported.

See related information.

Adjusting the Display Brightness

Switching Between 2D/3D Display Mode

Model Correspondence Table for Display Management

API Reference

Sample Code

2.2.1. Adjusting the Display Brightness

Since the Moverio has a see-through display, the visibility for displayed images changes due to the effect of the brightness of the surroundings. If the surroundings are bright, increase the brightness of the display; if the surroundings are dark, decrease the brightness to make the displayed image easier to view.

To adjust the brightness of the display, you first need to establish communication with the Moverio's display. To do this, create an instance of the DisplayManager class, and then call the open() method.

* When using the Moverio SDK's DisplayManager class, import com.epson.moverio.hardware.display.DisplayManager to avoid name conflict with the Android standard DisplayManager class, or set the class name at instance creation to com.epson.moverio.hardware.display.DisplayManager.

e.g. Import com.epson.moverio.hardware.display.DisplayManager

import com.epson.moverio.hardware.display.DisplayManager;

e.g. Create an instance of com.epson.moverio.hardware.display.DisplayManager

public class DisplayActivity extends Activity {
    private com.epson.moverio.hardware.display.DisplayManager mDisplayManager = null;

To manually adjust the brightness of the display, use the setBrightness() method. See Available brightness adjustment range for more information on the available brightness adjustment range.

When you have finished adjusting the brightness of the display, make sure you end communication with the Moverio's display. To end communication, use the close() method.

private DisplayManager mDisplayManager = new DisplayManager(context);
try {
    mDisplayManager.open();
} catch (IOException e) {
    e.printStackTrace();
}
mDisplayManager.setBrightnessMode(DisplayManager.BRIGHTNESS_MODE_MANUAL);
mDisplayManager.setBrightness(15);
mDisplayManager.close();

2.2.2. Switching Between 2D/3D Display Mode

The Moverio's display supports the Side-by-Side method for displaying 3D content. When displaying 3D content in Moverio using the Side-by-Side method, make sure you use the dedicated API to manage operations from the app.

The side by side method places images on the left and right of the screen.

When creating images using the Side-by-Side method, place the left eye image and the right eye image on the left and right sides of the image respectively.

For example, when creating a 1280 × 720 (HD size) Side-by-Side image, place a 640 × 720 image for the left eye and a 640 × 720 image for the right eye as shown in the following figure to build the Side-by-Side image.

To switch the 2D/3D display mode, you first need to establish communication with the Moverio's display. To do this, create an instance of the DisplayManager class, and then call the open() method.

Next, set the 2D/3D display mode for the display to 2D or 3D. Use the setDisplayMode() method to make settings. For 2D display mode, pass the DISPLAY_MODE_2D argument, and for 3D display mode pass the DISPLAY_MODE_3D argument.

When you have finished switching the 2D/3D display mode for the display, make sure you end communication with the Moverio's display. To end communication, use the close() method.

private DisplayManager mDisplayManager = new DisplayManager(context);
try {
    mDisplayManager.open();
} catch (IOException e) {
    e.printStackTrace();
}
mDisplayManager.setDisplayMode(DisplayManager. DISPLAY_MODE_3D);
mDisplayManager.close();

2.2.3. Creating Images Using the See-Through Type Display

The Moverio is equipped with a see-through type display that allows the wearer to superimpose images over their real-time surroundings. To superimpose the image of an object you want to display in Moverio over the wearers real-time surroundings, you can create an image that makes use of the see-through display by setting the background of the object you want to display to black.

2.2.4. Available brightness adjustment range

See following table on the available brightness adjustment range.

model brightness adjustment range
BT-35E 0 to 20
BT-30C 0 to 20

2.3. Sensor Management

The Moverio is equipped with a variety of sensors that detect movement, direction, and environment. You can use the Moverio SDK to capture the raw data from these sensors. The sensor data can be used to calculate the head movement of the user and the brightness of the surrounding environment.

Please refer to the related information.

Sensor type

Sensor axis

Acquiring sensor data

Model Correspondence Table for Sensor Management

API Reference

Sample code

2.3.1 Sensor type

The Moverio is equipped with various types of sensors. These sensors consist of both hardware and software-based types. Hardware-based sensors include those for acceleration, magnetic field, angular velocity, and surrounding ambient light. Software-based sensors consist of virtual sensors that use values output by a single or multiple hardware-based sensors. Virtual sensors can calculate items such as rotation vectors and gravity.

Sensor Type Description Use example
TYPE_ACCELEROMETER Hardware Measures the acceleration of the Moverio, including gravity, along the three axises (X, Y, and Z) in [m/s²]. Motion detection (slanting and so on)
TYPE_MAGNETIC_FIELD Hardware Measures the surrounding magnetic field along the three axises (X, Y, and Z) in [µT]. Position detection
TYPE_GYROSCOPE Hardware Measures the angular velocity of the Moverio along the three axises (X, Y, and Z) in [rad/s]. Motion detection (rotation and so on)
TYPE_GRAVITY Software Measures the acceleration of gravity along the three axises (X, Y, and Z) in [m/s²]. Motion detection (slanting and so on)
TYPE_LINEAR_ACCELERATION Software Measures the acceleration along the three axises (X, Y, and Z) with gravity removed in [m/s²]. Used for detecting tapping, walking, and similar actions
TYPE_ROTATION_VECTOR Software Measures the Moverio orientation in rotation vectors. Head tracking and so on

2.3.2 Sensor axis

The Moverio sensors use the same coordinate system as standard Android sensors. When wearing the Moverio, the X axis indicates rightward movement, the Y axis indicates upward movement, and the Z axis indicates the direction toward the user.

2.3.3 Acquiring sensor data

You can use the Moverio SDK to enable use of the various sensors equipped to the Moverio.

To acquire the sensor data, you first need to establish communication with the Moverio sensors. To do this, create a SensorManager class instance and call the open() method. When doing so, pass the listener instances of the sensor types and sensor data as arguments.

*Execute SensorManager#open after confirming that the image is displayed on the Moverio after 10 seconds or more has elapsed since connecting the smartphone with the Moverio via USB.

Otherwise, may not be able to SensorManager#open normally

* When using the Moverio SDK's SensorManager class, import com.epson.moverio.hardware.sensor.SensorManager to avoid name conflict with the Android standard SensorManager class, or set the class name at instance creation to com.epson.moverio.hardware.sensor.SensorManager.

e.g. Import com.epson.moverio.hardware.sensor.SensorManager

import com.epson.moverio.hardware.sensor.SensorManager;

e.g. Create an instance of com.epson.moverio.hardware.sensor.SensorManager

public class SensorActivity extends Activity implements SensorDataListener {
    private com.epson.moverio.hardware.sensor.SensorManager mSensorManager = null;

Sensor data can be acquired at any time necessary by use of the onSensorDataChanged() method for registered listeners. The onSensorDataChanged() method is called at extremely high speed. In order to ensure optimal use of sensors for an application, configure so that processing such as that requiring a great amount of time is not performed within the onSensorDataChanged() method. When you finish acquiring sensor data, make sure you end communication with the Moverio sensors. To end communication, use the close() method.

Sensor data can be obtained as an instance of the SensorData class. For details on the SensorData class, refer to API reference.

public class SensorActivity extends Activity implements SensorDataListener {
    private SensorManager mSensorManager = null;

    @Override
    public final void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mSensorManager = new SensorManager(this);
    }

    @Override
    protected void onResume() {
        super.onResume();
        try {
            mSensorManager.open(SensorManager.TYPE_ACCELEROMETER, mSensorDataListener);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    protected void onPause() {
        super.onPause();
        mSensorManager.close();
    }

    @Override
    public void onSensorDataChanged(SensorData data) {
        // Do something with this sensor value.
    }
}

2.3.4 Notes on sensor control

Sensor control using the Moverio SDK can only be used with a single application. When using sensor control with another application, be sure to stop using sensor control with an application that uses sensor control before using it.

2.4. Audio Management

The Moverio can insert earphones conforming to CTIA standard. The Moverio SDK allows you to manage the volume of earphones.

See related information.

Adjusting the volume of earphones

Model Correspondence Table for Audio Management

API Reference

Sample Code

2.4.1. Adjusting the volume of earphones

The Moverio can insert earphones conforming to CTIA standard. The Moverio SDK can increase or decrease the volume of earphones according to the surrounding environment.

To adjust the volume of earphones, you first need to establish communication with the Moverio's audio. To do this, create an instance of the AudioManager class, and then call the open() method.

* When using the Moverio SDK's AudioManager class, import com.epson.moverio.hardware.audio.AudioManager to avoid name conflict with the Android standard AudioManager class, or set the class name at instance creation to com.epson.moverio.hardware.audio.AudioManager.

e.g. import com.epson.moverio.hardware.audio.AudioManager

import com.epson.moverio.hardware.audio.AudioManager;

e.g. Create an instance of com.epson.moverio.hardware.audio.AudioManager

public class AudioActivity extends Activity {
    private com.epson.moverio.hardware.audio.AudioManager mAudioManager = null;

To manually adjust the volume of earphones, use the setVolume() method. See Available volume adjustment range for more information on the available volume adjustment range.

When you have finished adjusting the volume of earphones, make sure you end communication with the Moverio's audio. To end communication, use the close() method.

private AudioManager mAudioManager = new AudioManager(context);
try {
    mAudioManager.open();
} catch (IOException e) {
    e.printStackTrace();
}
mAudioManager.setVolume(12);
mAudioManager.close();

2.4.2. Available volume adjustment range

See following table on the available volume adjustment range.

model volume adjustment range
BT-35E 0 to 15
BT-30C 0 to 20

2.5. Debugging an application over the Network

In application development of USB-connected Moverios such as the BT-35E, you need to connect the Moverio to an Android smartphone by USB to check application operations. Currently, debugging cannot be performed because the computer and Android smartphone are not connected by USB.

As a method of solving the issue above, this section describes how to develop a USB-connected Moverio and an Android smartphone with a USB connection by connecting an ADB to an Android smartphone over the network. See the following websites for more information.
https://developer.android.com/studio/command-line/adb#wireless

  1. Connect the computer and the Android smartphone to the same network.
  2. Connect the computer and the Android smartphone by USB.
    * From here on, Android smartphones connected to the computer are described as singular.
  3. Run the following command on the computer to allow ADB to connect to the Android smartphone over the network.
    # adb tcpip 5555
  4. Disconnect the USB connection between the computer and the Android smartphone.
  5. Check the IP address of the Android smartphone.
    You can check the IP address for most Android smartphones from the settings screen. The method for accessing the screen where the IP address is displayed varies depending on the Android smartphone. For details, check the specific method for your Android smartphone.
  6. Run the following command on the computer to connect to the Android smartphone over the network.
    # adb connect ip_address
    Example: adb connect 192.168.1.10
  7. Execute the following command on the computer to check that the Android smartphone is connected to the computer by ADB.
    Make sure that the connected device is included in the list.
    Check the following points if it is not connected.
    • Are the computer and the Android smartphone connected to the same network?
    • Have you tried connecting again by running the procedure from step 3?
    • Is there an error in the IP address entered in step 6?
    # adb devices
  8. Install the application on the Android smartphone by using Android Studio, and then check the application operations.

2.6. Using the Moverio SDK from Kotlin

The following section explains how to use the Moverio SDK from Kotlin.

Including the Moverio SDK

Sample code for the Moverio SDK API

2.6.1. Including the Moverio SDK

Make sure you include the Moverio SDK into any projects for which Kotlin has been selected as the development language.
See the following for information on including the Moverio SDK.

2.6.2. Sample code for the Moverio SDK API

The following provides sample code for the Moverio SDK API from Kotlin.

2.6.2.1. Display control

Sample code for acquiring and setting the brightness.
See the following for information on display control.

val displayManager = DisplayManager(context)
try {
    displayManager.open()
} catch (e: IOException) {
    e.printStackTrace()
}

val brightness = displayManager.brightness // getBrightness
displayManager.brightness = brightness + 1 // setBrightness

displayManager.close()
2.6.2.2. Sensor control

Sample code for acquiring data for the accelerometer.
See the following for information on sensor control.

class SensorActivity : Activity(), SensorDataListener {

    private var sensorManager: SensorManager? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        sensorManager = SensorManager(this)
    }

    override fun onResume() {
        super.onResume()
        try {
            sensorManager?.open(SensorManager.TYPE_ACCELEROMETER, this)
        } catch (e: IOException) {
            e.printStackTrace()
        }
    }

    override fun onPause() {
        super.onPause()
        sensorManager?.close(this)
    }

    override fun onSensorDataChanged(SensorData data) {
        // Do something with this sensor value.
    }
}
Go to Top