mPower™ Blog Series

Developing Google Glass Applications for SAP

Google glass applications for SAP is soon shaping out to be the leader in wearable technology consisting of an optical head-mounted display (OHMD). Google Glass displays information in a smartphone like hands free format, letting wearers to communicate with the internet via voice commands in natural language.
It was launched in 2012 by Google, consisting of both the Mirror API and the Glass Development Kit (GDK), creating lot of curiosity among the developers and other users. Using Google Glass, developers can create amazing Glassware in order to build the application ecosystem for Glass.

If you opt to develop web based services that interact with Glass, you can use the Mirror API, enabling you to build web-based services that interact with Google Glass. One of the unique features of this Mirror API is it offers this functionality over a cloud-based API without the necessity to run code on Glass. On the contrary, GDK is an add-on for the Android SDK that helps you to build Glassware that can run directly on Glass.

Since its release in the market in 2012, there have been notable changes and enhancements in GDK; the current release being Glass XE 17.1. Now, let’s take a brief look at its basic features, which are as follows:

  • Touchpad: This is located at the side of the Google Glass, enabling you to control the device by swiping through a timeline-like interface displayed on the screen. When you slide backward, you can view current events, such as weather and when you slide forward, you can view past events consisting of phone calls, photos and much more.
  • Camera: Using camera, you can click photos and record 720P HD videos.
  • Display: The Explorer version of Google Glass uses a liquid crystal on silicon (LCoS), field sequential color and LED illuminated display. With this display, the light is reflected into your eye, enabling you to view crystal clear images.

Google Glass

The environment (pre-requisites) to develop google glass are: Eclipse IDE, Android SDK, Glass Development Kit and Mirror API.

This blog walks you through the various stages of glass development such as:
1. Downloading SDK
2. Installing drivers
3. Writing a simple hello world program
4. Deploying the same on glass.

Let’s explore each of the stages briefly:

I. Downloading GDK

GDK kit provides APIs to build glassware applications, which otherwise wouldn’t be available in all the versions of android.

1. From the android’s SDK folder, click SDK manager.
2. In the SDK Manager window:

  • Click to select Android 4.2.2 (API 19) and Google USB Driver (available under Extras).
  • Click Install Packages. Wait until all packages gets downloaded successfully.

II. Installing google glass drivers

The next step is to install Android google device drivers, which can be done either from Android SDK’s USB drivers or with the default software that comes from the device manufacturer. Since you can directly use USB driver for Google Glass, you need to however modify the android_winusb.inf file to ensure that it is listed properly in Eclipse.

1. Open the android_winusb.inf file that is available in the android_SDK_folder\sdk\extras\google\usb_driver path to edit this file.

2. Edit the file by typing the following code at the end of the file.

[Google.NTamd64]
;GoogleGlass
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_4E11&REV_0216
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4E11&MI_01
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_9001&REV_0216
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_9001&MI_01
[Google.NTx86]
;GoogleGlass
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_4E11&REV_0216
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4E11&MI_01
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_9001&REV_0216
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_9001&MI_01

3. Now open the Run window (use shortcut Win + R) and type devmgmt.msc and click OK. The Device Manager window opens.

4. In the Device Manager window:

  • Right click on your Google Glass device and install drivers.
  • Select android_winusb.inf parent folder and follow the appropriate instructions.

III. Creating new glass project

This is similar to creating a new project in android, provided you choose the proper API version. You can create a new Glass project in Eclipse.

1. Click File -> New and then click Android Application Project to initiate creating a new project.
2. In the Android Application Project window, type your application name, project name and the package.
3. In the Minimum Required SDK and Target SDK fields, type API 19: Android 4.4 (KitKat).
4. Compile using Glass Development Kit Sneak Peek (Google Inc.) (API19) and select the Theme to None.
5. Open AndroidManifest.xml file, once the project is created and delete the theme: android:theme property to enable glass to apply its own theme.
6. Open strings.xml file and type the below string values:

strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Hello Glass</string>
<string name="action_settings">Settings</string>
<!-- main activity strings -->
<string name="hello_glass">Hello Glass !</string>
<string name="home_url">www.androidhive.info</string>
<!-- "ok glass" voice command -->
<string name="start_command">Hello Glass</string>
</resources>

7. Now open your main activity layout file and paste the following code. activity_main.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:id="@+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_glass" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/home_url"
android:textSize="20dp" />
</LinearLayout>

8. Without any modifications, the code in the Mainactivity.Java file should look like this:

MainActivity.java
package info.androidhive.helloglass;
import android.app.Activity;
import android.os.Bundle;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}

Now we are done with the simple hello world program. In the next step, you will learn how to deploy this program.

IV. Running the application on glass

The pre-requisite to run the application on glass is to turn on the debug option.
1. On your Glass, click Settings, next click Device Info and then click Turn on debug.
2. Use a USB cable to connect the Glass to your PC.
3. Next right click Project and then click Run As ⇒ Android Application. Eclipse will list the glass in the list of available devices.
4. Select the appropriate device and then click OK. The app gets started running on your glass.

Conclusion

Google glass is a wearable technology that is slowly revolutionizing the way your apps are being developed and deployed. The above blog provided an overview of the various stages of glass development such as downloading SDK, installing drivers, writing a simple hello world program and deploying the same on glass. You can order this app from Google PlayStore to get started with building apps for your glass.

Request a Demo

If you would like to request a demo for SAPUI5, please click on the link above. Alternatively, if you would like to discuss with an Innovapptive solution expert, you can reach out to us by emailing us at sales@innovapptive.com or you can reach a sales representative at (713) 275-1804.

Share this post

Leave a comment

Your email address will not be published.