Development tips

On this page, you can find helpful tips we've distilled from our years of experience developing applications for Glass Enterprise Edition 2. We cover the following points so that you can have them in mind when you develop your own applications:

Avoid unresponsive UI elements

Don't use standard Android elements such as buttons, check boxes, and input text areas. These elements are treated by Glass as being unresponsive. Focus on the “one action per page” principle when you design the UI of your application.

If you need to use buttons, treat the entire page as a button.

If you need lists to show some content, use a standard recyclerView.

If you need to interact with elements of a list, Implement swipe views. Use the viewPager class to achieve this.

Build ID

To obtain information about your build ID, use the following command:

fastboot getvar version-bootloader

You can also find this information in: Settings > System > About phone > Build number.

Hide the status/action bar

The status bar can show some helpful information, such as your connectivity status or the clock, but if this kind of information is not crucial for the task at hand, feel free to hide the status and action bar. The user can always swipe down from the top edge of the screen to bring it back momentarily.

Kiosk mode

If you've developed an app to replace the Android Home screen and launcher, or if you want your app to be the only one working on the device, you should follow the instructions in the dedicated device cookbook.

When you use an MDM solution, you can push your custom launcher as the preferred persistent activity through the DevicePolicyManager API.

Make it full screen

To improve the user's experience, consider making your application full screen. This allows users to navigate through your application easier and increases the visible area that you can use to display content.

Serial number

The easiest way to obtain your serial number is to scan or read it off of the inner side of your Glass' pod. The serial number doesn't show in Settings, but you can run the following commands to obtain the device's serial number:

  1. adb reboot bootloader
    
  2. fastboot oem device-info
    

USB cable

We recommend that you use the USB-C™ cable that came with your device since it's required for fast charging. Other USB-C™ cables could work in a suboptimal way. If you do use a third party USB-C™ cable or power adapter, make sure it's enabled to transfer data and charge devices.