The new ThroughTheWalls native app for Google Glass brings AR apps on Glass into reality and won the Ericsson and Veracode prizes at the AT&T public safety hackathon this weekend in Palo Alto. Here’s how to put a real AR app together from all the samples and discoveries that surfaced recently! Video demo:
To pull this off, ThroughTheWalls tracks your location and the direction your Google Glass and head are facing - then populates the wearable heads up display with easy to follow instructions and vital data calculated from that. So if you are looking for shelter during an emergency like a flood or forest fire, the screen looks like this:

Once you turn to face the shelter, you can see exactly what angle it is from you on the screen with an indicator:


The example shelter data used was published by the San Diego County Emergency Site. In a world where many emergency response teams are still using 70 year old radio technology, San Diego Country have a mobile app and even sent someone to the hackathon to help out!
As the shelter locations are retrieved by the app via the Internet, they will be up to date even after installation. In future versions they could be cached to work even without internet. Using a live web service like this is great progress for a public safety system, however. We were told things like license plate checkers often run off data in the trunk of a police cruiser and miss new changes like a robbery car being added.
Swiping left or right on the glass changes to guiding to a different shelter if any. Swiping down gets you back to the menu of destinations including: California Highway Patrol incidents, large cities and monuments, and CCTV cameras. Tapping while viewing a CCTV camera will actually show the image taken from that camera immediately. Stuck not moving in traffic? A few quick taps let you look 2 miles down the road and see what is happening:



Tapping other items, like CHP incidents, shows the details of the incident:


The source and APK are available on GitHub. You can install the app if you have turned on debug mode via the “adb install ThroughTheWalls.apk” command. I recommend launching the app from launchy, an app launcher that replaces the default settings in Google Glass:

When writing your own AR apps, you can get sensors data by registering for updates like this:
mSensorManager.registerListener(this, mOrientation, SensorManager.SENSOR_DELAY_NORMAL);
final List providers = mLocationManager.getAllProviders();
for (String provider : providers) {
final Location lastKnownLocation = mLocationManager.getLastKnownLocation(provider);
mDisplay.setLocation(lastKnownLocation);
final boolean enabled = mLocationManager.isProviderEnabled(provider);
mLocationManager.requestLocationUpdates(provider, 0, 0, this);
}
Calculating bearing and distance to a location looks like this:
final Location currentLocation = new Location("ThroughGlass");
currentLocation.setLatitude(currentLat);
currentLocation.setLongitude(currentLon);
float bearingToAsEastOfNorthDegrees = currentLocation.bearingTo(targetLocation);
float delta = normalize(bearingToAsEastOfNorthDegrees - azimuth);
final String deltaString = 0 == delta ? "" :
delta > 0 ? (" right " + roundTenths(delta))
: (" left " + roundTenths(Math.abs(delta)));
text.setText(roundTenths(azimuth) + "° " + deltaString+ "°");
Drawing to the display based on the bearing looks like this:
final int width = getWidth();
final int height = getHeight();
final int indicatorWidth = mIndicator.getIntrinsicWidth();
final int indicatorHeight = mIndicator.getIntrinsicHeight();
final int offsetCenterX = (int) (width * mOffsetPercent);
final int indicatorLeft = offsetCenterX - (indicatorWidth/2);
final int indicatorTop = (height / 2) - (indicatorHeight/2);
mIndicator.setBounds(indicatorLeft, indicatorTop, indicatorLeft + indicatorWidth, indicatorTop + indicatorHeight);
mIndicator.draw(canvas);
Many thanks to Ericsson and Veracode for the prizes we won at the hackathon. Hopefully this helps kick start Google Glass AR development! Google recently announced an upcoming Glass Development Kit that will allow native apps like this, which is exciting news. Participating in the first ever public safety hackathon was also a thrill and there are many problems there that haven’t had modern technology applied to them.





















