Tuesday, December 17, 2013

How to Load Apps or Apk on Google Glass ?

For this tutorial we will show you how install Google Sky (also known as stardroid) without rooting your Glass or swapping roms. This is the same basic procedure you would go through to manually load an app on an Android phone, but since Google Glass has a limited amount of input, the specific app you install matters. 

Before we begin it is important that you already have the Android SDK, most importantly you need ADB (android debug bridge). You also need to be somewhat familiar with opening a new terminal window. We will work for Linux and might need a little modification for Windows. We also assume you download files to your home Download directory, but you can change this as needed. (~/Downloads)

Download and Install the Android SDK (http://developer.android.com/sdk/index.html). We find it helpful to have adb in your PATH so you can call it from anywhere (you may want to add it to your .bashrc or whatever you are using).

export PATH=$PATH:~/Downloads/adt-bundle-mac-x86_64-20130514/sdk/platform-tools

First things first, Put your Glass in “Debug Mode” in the settings on the Glass itself. Locate the device info and scroll right to turn Debug Mode on. Then plug your Glass into your computer using the USB micro cable.

Now grab a version of Google Sky that you want to install (this is the same for any Android .apk file).

wget http://file.appsapk.com/wp-content/uploads/apps-2/Google%20Sky%20Map.apk

Simply load the .apk file onto the Glass with adb.

adb install ~/Downloads/Google\ Sky\ Map.apk

After the .apk is loaded onto Glass you now need to use adb shell to run it. The trick here is that you need to figure out what Activity to run. You can use the adb command dumpsys to discover a plethora of information about your Glass. You can figure out the main activity for the .apk with a little help from grep, and since it was the last thing loaded we can also narrow this information down with a tail command.

adb shell dumpsys | grep android.intent.action.MAIN | tail -n 2

This might take some time depending on your system, but it will eventually return something similar to this:

intent={act=android.intent.action.MAIN flg=0×10000000 cmp=com.google.android.stardroid/.activities.SplashScreenActivity}
android.intent.action.MAIN:

You now have the right information to start the app on Glass. We use the am command to start the app on Glass. Simply reformat the Activity call to follow the same format as the stardroid example call below:

adb shell am start -a android.intent.action.MAIN -n com.google.android.stardroid/com.google.android.stardroid.activities.SplashScreenActivity

At this point tap your Glass on and the app should be running. You will need to “down swipe” on your glass to cancel the agreement window. If you see the app running, disconnect, go outside, and check this out at nighttime! Warning: you may feel like a terminator with some kind of super power.

Note: this is not part of the Official Glass Mirror API that is displayed on your timeline and running apps full time like this is a drain on the battery, which is not in Google’s application design guidelines. It merely demonstrates how to sideload an app on Glass in your terminal without voiding your warranty.