Google Glass Review – Part 1- 什么

Developing apps for Google Glass by Marcio Valenzuela
Developing apps for Google Glass

I got my Glass a little late…but here is my review!

What they are?

You might think the answer is obvious, but its not.  Its a wearable computer but its not a full blown computer.  Does that make it less of a computer?  Not really, unless you consider ipads and iphones less than a computer because you can’t do ALL the things you can normally do on a full blown laptop.

What can you do with them?

Since we already mentioned you can’t do everything you can on a full blown computer, let’s talk about what we CAN DO!

Out of the box, Glass comes with a few commands such as those for taking pictures, recording video and a few others.  Out of these features, probably the coolest is taking pictures and videos handsfree.  This is very nice because holding the phone with a busy hand is a pain, not to mention keeping it pointed in the right direction the whole time.

Ok so we wouldn’t pay money to get a wearable camera right!?  So what else can we do?  Google Glass connects to the internet via a mobile device (for now) or through a wifi connection.  This way you can access the apps for Glass and ‘install’ them.  Install is a relative words nowadays because much the same way iOS and Android and Computer based apps are now native & web based, so are Glass apps.  As a matter of fact the first Glass apps were all web based, called Glassware!  They were web services you accessed online and interacted with to do certain tasks.  This is what developers had access to in the beginning.  Now you can actually make native apps for Glass using their new GDK.  This lets you do some pretty neat things like play games and others.

There is so much, Ill just list what you can do with certain apps:

  1. Mini Games (tennis etc.) actually work with your head movements
  2. Allthecooks is an app for following and creating cooking recipes
  3. Google Gmail for checking…mail
  4. Google Hangouts for…hanging out 🙂
  5. Twitter
  6. Facebook
  7. Strava is a really neat biking stats app

How do they work?

You can interact with Glass using a finger taps or a combination of gestures & voice commands.  Your first interface with Glass is the “ok glass” menu which is your starting point in a linear timeline of sorts.  The “ok glass” menu looks like this:

Google Glass Menu Review by Marcio Valenzuela Santiapps.com
Google Glass Menu Review

This is the main card.  It displays the time and the command to give to Glass.  Speaking “ok glass” gives you access to a voice-command launch menu.  That menu card looks like this:

Google Glass Menu Review by Marcio Valenzuela Santiapps.com
Google Glass Menu Review

As you can see there are some options such as getting directions, sending messages, making calls or taking notes.  These are default commands installed.  As you install new apps, new commands are sometimes added to this menu.  Not all new apps add commands, some apps simply send you notifications or new cards only when an event takes place.  These usually come from those web based or Glassware apps we mentioned.  Such as when you get a call or email.

The rest of the time, your Glass has a timeline which looks like this:

58f15e36aeb609df7c1bc8dc2cdd0ac8_articlex

As you can see from the image, Present & Future cards are to the left and Past cards are on the right.  You can swipe through this timeline back and forth.

This gives you an idea of how it works.  Now on to the neat things you can do.

Glassware & Native Apps

Some cool apps I consider useful are the Stock cards, weather cards and WorldLens.  The Stock & Weather cards are Glassware that run off of a concept I was unfamiliar with until a few weeks ago, called Google Now Cards.  These are cards you create yourself and only send you info when important information changes.  You can use them in the Google Now iOS app for example.

The WorldLens app is one that lets you point Glass at a text in a foreign language and it will translate it for you!

Allthecooks lets you look up a recipe while cooking and you can go through it step by step!

Other apps I know people are working on or are out there but I don’t use:

Driving robots using your head to gesture direction.

GolfSight is an app that helps you play golf, calculating distances and club selection.

Youtube for sharing your Glass videos.

Spellista is a sort of spelling game that you can play with other users.

Ill keep posting with new app ideas I hear from fellow programmers.  Its pretty exciting to be able to interact with the internet, hardware and information handsfree.  I am personally juggling ideas for Solar Installations and programming aides using Glass.

Who is Glass NOT for?

People who are clumsy!

Develop apps for Google Glass – Part 3 – Setting up!

Developing apps for Google Glass by Marcio Valenzuela
Developing apps for Google Glass

If you have experience in Android (Java) development, this will be even easier.

What you’ll need:

  1. Google Glass – to test your apps on
  2. Eclipse or Android Studio for coding
  3. Android SDK 15 & Glass Development Kit Sneak Peek (GDK)
  4. Configure adb

Glass

Well you either borrow a pair or get your own, but you will need Google Glass to test your apps.  The reason being that there is no Glass emulator as there is for Android as of yet.

Eclipse or Android Studio

Eclipse is the most widely known IDE for Android programming but its worth getting to know Android Studio, the new IDE for developing on Android & Glass. You can get it here:

http://developer.android.com/sdk/installing/studio.html

This is version 0.4.2 but there is a new build, 0.4.3 (Canary) to date of this publication.

Its ok if you choose Eclipse, the differences are minimal in general usage terms.

Android SDK 15 & GDK

If you’re used to iOS, where the IDE (Xcode) already includes the SDK, you’re in for a treat. In this case its necessary to manually get the SDKs; both API 15 as well as GDK. To do this you use the Tools menu & select AVD Manager:

Android Studio SDK Manager Glass GDK Sneak Peek by Marcio Valenzuela Santiapps.com
Android Studio SDK Manager Glass GDK Sneak Peek

Now you must pick the right SDKs. I recommend getting these options:

Android Studio SDK Manager Glass GDK Sneak Peek by Marcio Valenzuela Santiapps.com
Android Studio SDK Manager Glass GDK Sneak Peek

To install you must then click on Install Packages and individually Accept each license. This will take a while for the SDKs to download.

ADB

Now you’re ready to start programming, sorta.  You need the Android Debug Bridge, ADB.  This allows us to connect to Android/Glass devices and debug directly on them.  Again, if you’re coming in from an iOS environment you test on the iPhone Simulator and thats good enough to get started.  However, on Android, BELIEVE me, you DO NOT want to test on the emulator.  Both Eclipse and AS bring the AVD Manager, Android Virtual Device Manager which creates emulators in many configurations.  Just launching these can sometimes waste up to 15 minutes of your precious time.  This means that in a day of coding you can literally waste HOURS just waiting for the emulator to fire up.

Besides, as we mentioned, you can’t test Glass apps on anything but Glass devices.  So this is necessary.

Fortunately if you installed Android Studio, adb is already in Android Studio.app/sdk/platform-tools. If you’re on a mac you will need to add this path as an environment variable.  You might even need to create a symbolic link.  This is due to the fact that Android Studio is contained in one of these peculiar .app folders.  As you will see later, its hard to configure some neat development tools if you have files you need to get at, stored inside one of these .app packages.  You can inspect the application package in Finder:

Android Studio Package Contents Environment Variables Symbolic Links ADB Configuration by Marcio Valenzuela Santiapps.com
Android Studio Package Contents Environment Variables Symbolic Links ADB Configuration

In order to add an environment variable we first need to edit our ~/.bash_profile from terminal by doing this:

pico ~/.bash_profile

Now add the following line inside pico:

export PATH=/Applications/Android\ Studio.app/sdk/platform-tools:$PATH

this is assuming you installed Android Studio inside your Applications folder.

Now dab is accesible from any terminal.  So test it by opening a terminal and doing this:

adb devices

this should start the adb daemon and list all devices plugged into your USB ports which are in Debug Mode.

Finally, a cool dev tool is an app called Droid@Screen which can be used to display your Glass screen on your development computer screen.  you can get the latest version of it here:

http://droid-at-screen.ribomation.com/download/

The most current version was 1.0.2 to date of this publication.

In order to configure Droid@Screen we need to tell it where adb is.  The Android Studio.app folder structure we talked about is not recognized by most apps.  This it is necessary to create a symbolic link to our dab file. We can do this by using this command:

ln -s /Applications/Android Studio.app/sdk/platform-tools/adb /Applications/adb

which creates a symbolic link from the first URL via the second URL.  Now you can point your Droid@Screen configuration to this path.

You are ready to create Glass apps!

Any questions can be addressed to @santiapps.com

Blocks & Completion Handlers

Blocks in iOS for Completion Handlers by Marcio Valenzuela Santiapps.com
Blocks in iOS for Completion Handlers by Marcio Valenzuela Santiapps.com

Think of blocks as c functions:

(return type)functionName(input1, input2) { input1 + input2 }

and you call it like this:

return type = functionName (1,2)

Blocks are similar:

NSInteger (^mathOperation)(NSInteger x, NSInteger y) = ^NSInteger(NSInteger x,NSInteger y){ return x + y; };

You call it like this:

NSInteger sum = mathOperation(1,2);

Now imagine how cool it is to, instead of just passing a value to a method (like saying: here is a value, evaluate it), you can pass a whole method to it (like saying: here is something else to do!). Or better yet, here do this but only when you finish doing that! Like, load the users posts or tweets after you finish authenticating him! This is the called method:

-(void)countToTenThousandAndReturnCompletionBLock:(void (^)(BOOL))completed{

int x = 1;

while (x < 10001) {

NSLog(@”%i”, x); x++;

}

completed(YES);

}

This method takes a block and that block takes a Boolean.

And this is the calling method:

NewSimpleCounter *newSimpleCounter = [[NewSimpleCounter alloc] init];

[newSimpleCounter countToTenThousandAndReturnCompletionBLock:^(BOOL completed){

if(completed) {

NSLog(@”Ten Thousands Counts Finished”);

}

}];

So we call the method and say to it:

“Count to 10,000 and when you are done, here is a block to execute”. So it counts and when it’s done, it sends YES to the block. Then it evaluates the block and since it’s yes, it completes!