Open In App

Getting Started with Google Glass Development in Android

Improve
Improve
Like Article
Like
Save
Share
Report

We all know that Google glass is there in the market but it does not have much popularity as it’s very costly and did not in very handy also its performance is not that we would expect from a google product. But it’s certain that in the upcoming few years google glass will become popular and low cost so many people could use it. As an Android developers, we should know how to make apps for Mobiles only but it’s worth learning apps for other devices like watches, glasses. In this article, we are going to learn about how to get started with Google Glass Development in Android. We will perform the following steps.

  • Downloading GDK (Glass Development Kit)
  • Installing Google Glass Drivers
  • Creating new Glass Project
  • Running the Application on Glass

Downloading GDK (Glass Development Kit)

Right-click on file > settings > Android SDK As shown below. After going here three tabs will appear from that, select SDK Tools then select Google USB driver, and install its packages. Downloading these packages takes some time so be patient.

Downloading GDK (Glass Development Kit)

Installing Google Glass Drivers

Android device drivers can be installed from android SDK’s google USB drivers or with the help of software that comes from the device manufacturer. In the case of Google Glass, we can directly use google USB driver. But before installing that we need to a modification in the android_winusb.inf file, else, our glass device won’t be listed in Android Studio even though you have installed the drivers correctly.

Step 1: 

Go to Android SDK folder which is at c > users > username > AppData > Local > Android > SDK. Now go to extras > google > usb_driver and edit android_winusb.inf. and add the below text at the end of the file. As shown below and text is also given below.

[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

Step 2: 

Now open Run, you can open it with (shortcut Win + R). Then type devmgmt.msc and press OK. This will open up the Device Manager window.

Step 3:

In device manager, right-click on your Google Glass device and click install drivers. Then when it asks for browse location, select android_winusb.inf parent folder that we just edited and follow the instructions as shown there.

Creating new Glass Project

Creating a glass project is the same as we normally create our android project, it’s no big deal. But the only difference is you must change your API while you are about to create a new Project.

Step 1: 

Right-click on the File button then new->Android Application->Name. There will also be an option for selecting the API and language. For language, we are choosing Java and For API it must be at least 19. Do just like shown below.

Step 2:

After the project is created go to the AndroidManifests.xml file and remove the android:theme property which is present inside the <application> tag. By doing this the glass will apply its own theme to the app when it’s installed.

Step 3: 

Now go to the strings.xml file which is at res > values > strings. Now add the below string values

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.geeksforgeeks.com</string>
       
    <!-- "ok glass" voice command -->
    <string name="start_command">Hello Glass</string>    
   
</resources>


Step 4: 

Now open the activity_main.xml file, remove all the code and add the new code given below.

XML




<LinearLayout 
    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>


Running the Application on Glass

Its been a long time since Google Glass was launched but still, we do not have any smart glass emulator for testing. So we have to test it in the actual google glass device by changing some settings in it

Step 1:

We need to enable the debug option in the Google Glass device, for that, go to Settings->Device Info->Enable Debugging 

Step 2:

For connecting the Google Glass to your computer or laptop you need a USB cable which is simply the wire we use to charge the Google Glass or our Mobile phone. Then just simply click on run, the app will be installed in Google Glasses and you will see the following output.

Output:

Output :



Last Updated : 28 Feb, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads