Glass EE2 is conceived mainly as a single purpose tool for Enterprise. In most cases, partners develop their own experiences, which include a launcher or kiosk mode app that takes over from the moment Glass boots up.
Launcher
Glass comes with a launcher and a settings app.
Add an application to the launcher
In order to show your application on the launcher application list, you need to add
com.google.android.glass.category.DIRECTORY
to the main activity in your
application's manifest:
<activity android:name="com.example.android.glass.cardsample.MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <category android:name="com.google.android.glass.category.DIRECTORY" /> </intent-filter> </activity>
Settings
The Glass Settings app allows users to check the battery level, connect to Wi-Fi and Bluetooth, modify the volume and brightness, factory reset, and to check the firmware version, serial number and free storage space of the device.
Wi-Fi settings
When you connect to a Wi-Fi network with a password, you must use a QR code that should comply with Wi-Fi network configs.
One easy way to generate the Wi-Fi code is to use a generator such as QiFi.
Settings intents
Applications can use intents to take advantage of the Glass Settings UI.
Launch settings
To launch the Glass Settings app, start it as any other Android activity:
adb shell am start -n com.google.android.glass.settings/.MainActivity
Settings pages
To launch a specific page in Settings, Glass supports the following actions:
adb shell am start -n com.google.android.glass.settings/.MainActivity -a android.settings.BATTERY_SETTINGS
adb shell am start -n com.google.android.glass.settings/.MainActivity -a android.settings.WIFI_SETTINGS
adb shell am start -n com.google.android.glass.settings/.MainActivity -a android.settings.BLUETOOTH_SETTINGS
adb shell am start -n com.google.android.glass.settings/.MainActivity -a android.settings.VOLUME_SETTINGS
adb shell am start -n com.google.android.glass.settings/.MainActivity -a android.settings.BRIGHTNESS_SETTINGS
adb shell am start -n com.google.android.glass.settings/.MainActivity -a android.settings.DEVICE_INFO_SETTINGS
adb shell am start -n com.google.android.glass.settings/.MainActivity -a android.settings.SHOW_REGULATORY_INFO
adb shell am start -n com.google.android.glass.settings/.MainActivity -a android.settings.SYSTEM_SETTINGS
adb shell am start -n com.google.android.glass.settings/.MainActivity -a android.settings.DATE_SETTINGS
adb shell am start -n com.google.android.glass.settings/.MainActivity -a android.settings.LOCALE_SETTINGS
adb shell am start -n com.google.android.glass.settings/.MainActivity -a android.settings.INPUT_METHOD_SETTINGS
adb shell am start -n com.google.android.glass.settings/.MainActivity -a android.settings.DEVELOPMENT_SETTINGS
adb shell am start -n com.google.android.glass.settings/.MainActivity -a android.settings.FACTORY_RESET_SETTINGS
User restrictions
To make sure devices are used as intended, enable user restrictions on settings.
The following snippet shows how you can set the restrictions:
Kotlin
val devicePolicyManager: DevicePolicyManager = context.getSystemService(Context.DEVICE_POLICY_SERVICE) as DevicePolicyManager val adminName = getComponentName(context) arrayOf( UserManager.DISALLOW_CONFIG_WIFI, UserManager.DISALLOW_CONFIG_BLUETOOTH, UserManager.DISALLOW_FACTORY_RESET ).forEach { devicePolicyManager.addUserRestriction(adminName, it) }
Java
String[] restrictions = { UserManager.DISALLOW_CONFIG_WIFI, UserManager.DISALLOW_CONFIG_BLUETOOTH, UserManager.DISALLOW_FACTORY_RESET}; final DevicePolicyManager devicePolicyManager = (DevicePolicyManager) context.getSystemService(Context.DEVICE_POLICY_SERVICE); final adminName = getComponentName(context); for (String restriction: restrictions) { devicePolicyManager.addUserRestriction(adminName, restriction); }
The following is a list of available user restrictions:
UserManager#DISALLOW_CONFIG_WIFI
UserManager#DISALLOW_CONFIG_BLUETOOTH
UserManager#DISALLOW_ADJUST_VOLUME
UserManager#DISALLOW_DEBUGGING_FEATURES
UserManager#DISALLOW_FACTORY_RESET
Hinge auto shutdown timeout
When you close the hinge and the device isn't connected to any power source, it shuts down after four hours of inactivity. To change this behavior, Glass supports the following actions:Disable auto shutdown
adb shell am start \ -a com.google.android.glass.settings.mcu.HINGE_SHUTDOWN_TIMEOUT_ACTION \ --ei com.google.android.glass.settings.mcu.HINGE_SHUTDOWN_TIMEOUT -1
Immediate auto shutdown
adb shell am start \ -a com.google.android.glass.settings.mcu.HINGE_SHUTDOWN_TIMEOUT_ACTION \ --ei com.google.android.glass.settings.mcu.HINGE_SHUTDOWN_TIMEOUT 0
Auto shutdown after a specified time
adb shell am start \ -a com.google.android.glass.settings.mcu.HINGE_SHUTDOWN_TIMEOUT_ACTION \ --ei com.google.android.glass.settings.mcu.HINGE_SHUTDOWN_TIMEOUT time_in_minutes
Install applications
To install an application on Glass, do the following:
- Download Android Debug Bridge on your computer.
- Use the command line terminal on your computer to add the downloaded
platform-tools
directory to the systemPATH
variable:- Windows
set PATH=%PATH%;C:\path\to\platform-tools
- Linux and MacOS
- Download the APK file to your computer from your solution provider.
- Connect Glass to the computer with a USB cable.
- If a prompt appears on the screen, tap to allow USB debugging on Glass.
- Open a command line terminal on your computer.
- Follow the adb instructions to install the APK.
echo "export PATH=\$PATH:/path/to/platform-tools" >> ~/.bash_profile && source ~/.bash_profile