Monday, 27 May 2013

Run Google Glass on your Android phone

google glass home screenThere has been lots of buzz on the Internet about Google Glass, some has been positive, some has been negative (particularly around privacy issues), however the biggest problem is that ordinary folks, like me and you, can't try out Google Glass for ourselves to see what all the fuss is about because there are only a limited number of devices out there. Plus there are the minor issues of the $1500 needed to buy it and the fact that the program is invitation only. What to do?
The answer of course is to run Google Glass on your Android phone or tablet. OK, you probably shouldn't try and mount it on your head with rubber bands and Scotch tape, but you can play with the interface and test out what kind of things Google Glass can do.
Thanks to the efforts of Zhuowei Zhang it is now possible to install different parts of the Google Glass software on your Android device via .apk files. An .apk is the standard app file format, similar to a .exe on Windows. To install the .apk files you need to check that your device can install .apk from locations other than Goolgle Play. To do this go to Setting->Security and make sure that “Unknown Sources” is checked. This will allow the installation of apps from sources other than the Play Store.
Google Glass Voice Commands
Head over to https://github.com/zhuowei/Xenologer and download and install glasshome-modded.apk. This will give you the basic Glass home screen. Once you start the app (called “Glass Home”) you will be presented with the “standard” Glass home screen and clock that real Glass users see projected onto their eye. Say “OK Glass” to access the menu. Just speak to your phone or tablet to try other things. I said, “Google Android Authority” and this is what I saw:
google glass android authority
The next thing to do is install the camera, hangouts and maps modules. That should enable the Glass Home app to interact with the camera (even just the front facing camera on devices like the Nexus 7), start hangouts and access Google Maps. However with maps I found that I couldn't get passed the initial warning screen (which told me to keep my eyes on the road) and Hangouts crashes on Android 4.2 due to a change in the underlying Android code!
Although this isn't going to be a full glass experience, it will give you a feel for what Glass can do. It also opens up more possibilities for what Google could add to the normal Android interface.



Xenologer: repackaging Google Glass XE5 APKs to run on other devices

Google Glass's build process is fairly conservative - they don't use hidden APIs often, and when they do, they use reflection. Thus, it is relatively easy to repackage the Glass APKs for other devices.

Modifications to the base APK

The use-library element in AndroidManifest is removed, as it refers to unused code.
com/google/glass/hidden/HiddenViewConfiguration.smali is patched to always return 0xffff instead of calling the nonexistent View.getDeviceTapTimeout
An instructional video (don_doff_background.mov, 8MB) is removed to save space.
All native libraries required are shipped with the APK, as are all the Glass fonts.
For the camera, instead of calling Camera.open() to get the rear facing camera, Camera.open(0) is called to get the first camera, as the Nexus 7 doesn't have a rear camera.

Install

Download the APK:
This one's been modified so that instead of scanning a barcode, it uses the existing Google Account to setup and then force closes.
Install just like any other boring APK. None of the Google Glass apps need system privilages. I do not recommend installing these APKs as system APKs, as the Glass apps will attempt to reboot the phone after a force close.

Glass apps that won't be converted

Hangouts: crashes on Android 4.2 due to a change in the underlying Android code. If you have another version of Android, try http://zhuowei.github.io/Xenologer/glasshangouts-modded.apk
GlassSound.apk: installs and runs without modification. Get a copy from any XE5 system dump. Not essential for Glass; Glass will just run muted without it.
GlassPhotosphere.apk: As stated by http://www.studio8apps.com/running-google-glass-photo-sphere-viewer-on-android-phone/ , runs (for the easter egg) without modification. Again, any dumped copy from a XE5 should run fine. Not essential to Glass.

Building these APKs from the modified dump

This area is still quite rough - I would love some help!
These sources are managed with a shell script (because I am not familiar with git submodules).
Run getsrc.sh then one of the build*.sh to build the APK you want. You need to modify them to suit your needs. In particular, there's a dosignapk.sh script that they call, which signs the APKs with your key. Go to http://developer.android.com/tools/publishing/app-signing.html for details.
You must have APKTool, 7Zip, and the Android SDK in your path.
Finally, note that the build scripts copy the com folder into the resulting APKs, as APKTool is too dumb to get them from the original APK.

Credits/License

While I don't have permission from the Glass team to post these, Google Glass is a device for explorers, thus, I believe it agrees with the spirit of discovery to post these APKs.



No comments:

Post a Comment