we recently developed our Jenkins integration for Google Glass, called „Jenkins for Glass“ and we needed a way to configure e.g. the server and the credentials.
A very good way to do this is via QR code because it is the easiest way to implement. The only challenge on Google Glass is that the current GDK (Glass Development Kit) does not offer a QR code reader although they are using it internally for the setup process.
Anybody who had to work with QR code processing should have heard of the famous QR code framework ZXing, which is also maintained by Google. As a result we wanted to integrate this library into our Google Glass application – and it failed in the first try….Well it worked somehow, but the preview window looked terrible – totally distorted and blurry with freaky colours.
But we investigated some time and found a nice and simple way get it up and running:
First we need to clone the current version of ZXing, which can be found on Github: [https://github.com/zxing/zxing](https://github.com/zxing/zxing)
Next we imported the Android library into Eclipse and opened up the CameraConfigurationManager.
We added a new method called _googleGlassInit(Camera camera)_ which initializes the camera in a Google Glass specific way (you can find the source-code below).
This method has to be directly called after _camera.setParameters(parameters)_ has been called. We found two methods were this method call occured: _setDesiredCameraParameters(Camera camera, boolean safeMode)_ and _setTorch(Camera camera, boolean newSetting)._
Loading Github Gist …After these changes have been made, we used the final library in our Google Glass application and used it as one would use it in a „normal“ Android application.
We will propose these small changes to integrate them into a Google Glass module. We will keep you up to date on the progress.
We hope you got it working!
As always, comments below.