First Steps with Google Glass
Go Up to Creating an Android App
FireMonkey now supports apps that target the Google Glass device.
- 1 Creating a Google Glass App
- 1.1 Install the USB Driver for Your Glass Device
- 1.2 Create a Multi-Device Application with Target Platform Google Glass
- 1.3 Set the Google Glass Design Device
- 1.4 Use the GoogleGlass Style for Your App
- 1.5 How to Disable the Status Bar
- 1.6 How to Integrate Your Apps into the "ok glass" Voice Menu
- 2 How to Delete an App
- 3 See Also
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
- 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.
- Check that the device appears as a target in the Project Manager, under the Android SDK.
- 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:
- From the Tool Palette, add a TStylebook to your form.
- Double-click the TStylebook component. The FireMonkey Style Designer opens.
- Click Load, and the Open dialog box opens.
- Choose C:\Users\Public\Documents\Embarcadero\Studio\15.0\Styles\Android\
- Select GoogleGlass.fsf as a FireMonkey Style, and click Open.
- Click Apply and Close.
- 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 application do not use to incorporate a status bar.
Disabling the status bar is a two-step process:
- Set the BorderStyle property on the form to None.
- Go to Project > Options > Version Info.
- On the Target select All configurations > Android platform from the drop down menu.
- 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
- Add a new XML File to your project by right-clicking the Project Manager and selecting Add New > Other > Web Documents > XML File.
- Rename the XML File to voice_trigger_start, for example.
- Save the XML File to your project's folder.
- 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.
- Choose Project > Deployment.
- Select All configurations - Android platform from the drop down menu.
- Click Add Files .
- Add the voice_trigger_start.xml file.
- 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 https://developers.google.com/glass/develop/gdk/voice.
Modifying the AndroidManifest.xml
- 1. After building your project for the first time, 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="com.google.android.glass.action.VOICE_TRIGGER" />
- 2. Inside the <activity> element, add:
<!--Meta data for the voice trigger --> <meta-data android:name="com.google.android.glass.VoiceTrigger" android:resource="@xml/voice_trigger_start"/> <!--@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="com.google.android.glass.permission.DEVELOPMENT" />
- Note: For more information on the system voice commands available, see https://developers.google.com/glass/develop/gdk/reference/com/google/android/glass/app/VoiceTriggers.Command.
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
If there is only one emulator running or only one device connected, the adb command is sent to that device by default. If multiple emulators are running and/or 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