First Steps with Google Glass

From RAD Studio
Jump to: navigation, search

Go Up to Creating an Android App

FireMonkey now supports apps that target the Google Glass device.

Creating a Google Glass App

Install the USB Driver for Your Glass Device

Install the Google USB Driver as described in Installing the USB Driver for Your Android Device.

Create a Multi-Device Application with Target Platform Google Glass

  1. Choose File > New > Multi-Device Application and choose either Blank Application or any template that you want to use on Google Glass. The multi-device templates are automatically formatted and sized for the target device.
  2. Check that the device appears as a target in the Project Manager, under the Android target platform node.
  3. Ensure that the Google Glass device is selected (the active target appears in bold).

Set the Google Glass Design Device

The Form Designer provides a Google Glass view. This new view is optimized for the Google Glass user interface and resolution. Using the Google Glass view ensures that the components in your application appear in the correct place.

  • On the Form Designer, choose Google Glass from the View Selector drop-down menu:

Use the GoogleGlass Style for Your App

On the Google Glass device, dark colors are more suitable for the eye than bright colors. RAD Studio includes a dark FireMonkey style that is customized for Google Glass.

To use the Google Glass style in your form, follow these steps:

  1. From the Tool Palette, add a TStylebook to your form.
  2. Double-click the TStylebook component. The FireMonkey Style Designer opens.
  3. Click Load, and the Open dialog box opens.
  4. Choose C:\Users\Public\Documents\Embarcadero\Studio\22.0\Styles\Android\
  5. Select GoogleGlass.fsf as a FireMonkey Style, and click Open.
  6. Click Apply and Close.
  7. On the Object Inspector, for the TForm component, add to the StyleBook property the name of the TStyleBook component, such as StyleBook1.

Your app should look like the following screenshot if you are using the Tabbed With Navigation application template:


How to Disable the Status Bar

Google Glass applications seldom provide a status bar.

Disabling the status bar is a two-step process:

  1. Set the BorderStyle property on the form to None.
  2. Go to Project > Options > Version Info.
  3. On the Target select All configurations > Android platform from the drop down menu.
  4. Change the value for the theme key to No TitleBar.

How to Integrate Your Apps into the "ok glass" Voice Menu

To integrate your app into the ok glass voice menu, you have to set up a voice trigger and include it in your AndroidManifest.xml file:

Creating an XML File with the Trigger

  1. Add a new XML File to your project by right-clicking the Projects Window and selecting Add New > Other > Web Documents > XML File.
  2. Rename the XML File to voice_trigger_start, for example.
  3. Save the XML File to your project's folder.
  4. Edit the XML File to add these lines:

     <!--Include the name of the voice trigger:-->
     <trigger keyword="Voice_Trigger_Name"> </trigger>
     <!--Note: This name also appears as the name of the app in the 'ok glass' menu.-->

Including the New XML File in the Deployment Manager

You need to include the previously created resource XML file in the Deployment Manager. This ensures its deployment to the device inside the apk package.

  1. Choose Project > Deployment.
  2. Select All configurations - Android platform from the drop down menu.
  3. Click Add Files DMgrAddFiles.png.
  4. Add the voice_trigger_start.xml file.
  5. Edit the remote path to res\xml where XML files are located on Android devices.
Note: For more information on the Google Glass Voice Trigger, see

Modifying the AndroidManifest.xml

1. After building your project for the first time with the Android platform selected on the Projects Window, the AndroidManifest.template.xml is added to your project folder.
Note: See Customizing Your AndroidManifest.xml File for more information.
2. Add the AndroidManifest.template.xml file to your project.
3. Edit the AndroidManifest.template.xml file to add the following lines:
1. Inside the <intent-filter> tag, add:
        <!--Intent filter for voice trigger:-->
        <action android:name="" />
2. Inside the <activity> element, add:
        <!--Meta data for the voice trigger -->
        <!--@xml/voice_trigger_start is a reference to the voice_trigger_start.xml-->
4. To use a non standard voice trigger command, you need to include a special permission:
Below the <%uses-permission%> line, add the following special permission:
        <uses-permission android:name="" />
Note: For more information on the system voice commands available, see

How to Delete an App

You can uninstall applications from the Google Glass device by using the Android Shell Command. You need to have adb (Android Debug Bridge) on your system. Adb is delivered with the Android SDK.

You can locate the adb tool at C:\Users\Public\Documents\Embarcadero\Studio\22.0\CatalogRepository\AndroidSDK-<Version>\platform-tools.

If there is only one device connected, the adb command is sent to that device by default. If multiple devices are attached, you need to use the -s option to specify the target device to which the command should be directed:

adb [-s <serialNumber>] <command>
  • To list all the devices attached:
adb devices -l
  • To list all the packages installed on your device:
adb shell pm list packages
  • To uninstall a package:
adb shell pm uninstall com.embarcadero.ProjectName

See Also