Hello Google Glass: Deploying Applications with Appmethod

Posted by on in Tools

This tutorial will take you through the steps to deploy applications to Google Glass with Appmethod.

Step 1: Connect Glass with your Computer

Install Drivers

Head over to the Android developer page and download the latest Google USB Driver Zip file.

Connect Google Glass to your PC and open up the Device Manager. Locate and right click Glass; it should be listed under Portable Devices and may show up as an unknown device. Select Update Driver Software… and browse to the /usb_driver folder contained within the downloaded Google USB Driver Zip file.

Configure Glass for Developer Mode

In order to deploy custom applications to Glass debug mode must be enabled. From the Glass home screen, swipe left to Settings and tap. Swipe right to Device info and tap. Next, swipe right and tap the Turn on debug option. This will enable the Developer settings options under the settings menu. From within the Developer settings menu turn on the option Keep screen on while charging. This will prevent Glass from going to sleep while working with the device.

If the screen is left running too long Glass will tend to heat up. Manually putting Glass to sleep between deployments will keep it nice and cool during application development.

Query Glass Connectivity

The state of any connected Android device can be queried via the Android Shell Command by using the Android Debug Bridge (adb) executable. This executable is bundled with Appmethod at the following path:

 *Install Path*\\Android SDK\\adt-bundle-windows-x86-20131030\\sdk\\platform-tools

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:

General use:
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

adb-devices.png

After running adb devices –l Glass should be listed as a device as above. If it is listed as unknown go back to Glass settings and toggle Debug off and back on. This will cause Glass to re-authenticate with your computer. Execute adb devices –l again and the expected return of device should appear.

Appmethod is now ready to deploy applications to Google Glass.

Step 2: Build the C++ Multi-Device Application

Begin by clicking File->New->Multi-Device Application – C++ and select a Blank Application.

If this is the first time using Appmethod to deploy to an Android device be sure to complete the following tutorial: set up your development environment on windows.

Set the target deployment device to Android Glass.

b2ap3_thumbnail_select-android-view.png

b2ap3_thumbnail_design-view-glass.png

Next, set the Google Glass Design Device view:

b2ap3_thumbnail_Glass-Design-view.png


The FireUI Multi-Device Designer provides a Google Glass design-time form. This new multi-device designer can be used to optimize your app for the Google Glass form factor (user interface and resolution). The Google Glass designer will present your app exactly as it will appear on the device.

From the Tool Palette drag a TLabel to the Form Designer. Select the label and from the Object Inspector window set the Align property to Center and the TextSettings->HorzAlign property to Center. This will absolutely center the text on the Glass screen. Increase the font size by setting the TextSettings->Font->Size property to something like 50.

From the Project Manager window right click on Project1 and rename it to HelloGlass.

b2ap3_thumbnail_hello-glass-project-manager.png

When building Glass applications is it important to keep in mind that dark color schemes are more suitable for the eye than bright colors. Using a pure white background, for example, will create a tremendous amount of eyestrain. Appmethod includes a dark FireMonkey style that is customized for use with Google Glass.


The FireMonkey Style needs to be applied to both the Master view and the Google Glass view.

  • Select the Master view
    b2ap3_thumbnail_select-master-view_20140916-181851_1.png
  • Use the Tool Palette to add a TStylebook on the form.
  • Double-click the TStylebook component and click Load.
  • Navigate to <<>>C:\\Users\\Public\\Documents\\Embarcadero\\Studio\\15.0\\Styles\\Android
  • Select GoogleGlass.fsf as a FireMonkey Style, and click Open.
  • Click Apply and Close.
  • Look to the Structure window and select the root item; Form1.
    b2ap3_thumbnail_form-style_20140916-182235_1.png
  • From the Object Inspector set the StyleBook property to the name of the style book; StyleBook1.
  • Change the view back to Google Glass.

    b2ap3_thumbnail_Glass-Design-view.png
  • Again look to the Structure window and select the root item; Form1_GGlass.
  • From the Object Inspector set the StyleBook property to the name of the style book; StyleBook1.

The Google Glass Style has now been applied and the Hello Glass application is ready to Run!

b2ap3_thumbnail_screenshot.png

 



About
Gold User, Rank: 8, Points: 399
Brian Alexakis is a Product Marketing Manager at Embarcadero Technologies. He is focused on leveraging the connected world of technology to build new experiences for the Internet of Things.

Comments

Check out more tips and tricks in this development video: