How to launch a custom Android app in Google Glass

In this post, I’ll guide you on how to open a custom or your own app using the default voice commands in the Google glass.
I want to mention at this point, that to do this you need to have some knowledge on Android programing. And do this exercise in the emulator we created in our last post, don’t try it on the real glass because it may malfunction the glass, I have not tested it in the glass .Try it in your glass at your own risk.

If we see how the google glass works,  it will open a certain app(apk) using the package name for a predefined voice command.

As for now we don’t have  an sdk to develop our own voice command and an app to open from it. So what I am gona do here is replace a default app that will launch for a voice command and gona launch our own app instead.

In this example, I am gona replace glasscamera with my own app. To do so backup the glass camera app, and delete it from the glass.

First refactor the package name of your app to “com.google.glass.camera”
Now open your app’s manifest file
In the manifest file, change the package name in to “com.google.glass.camera”
Then change the Intent filter inside the activity tag of your app with this Intent filter

<intent-filter>
                <action android:name=”com.google.glass.action.TAKE_PICTURE” />
                <category android:name=”android.intent.category.DEFAULT” />
            </intent-filter>
Thats it now compile and install/push the apk into the glass/phone and nowSay the Command “Ok Glass”  “Take a Picture” TADAAAA…..!Now your app will open, instead of capturing the image…!

Advertisements

2 thoughts on “How to launch a custom Android app in Google Glass

  1. Hi. I was wondering. To access the source code and do the alterations, do we need to decompile the glasscamera apk? like what is mentioned in a previous post (Let’s Hack Android Apks)
    or is there a simpler way?

    Many thanks

    1. De compile and do an alteration and recompile is not possible using the article ‘Let’s Hack Android Apks’, because even though we are decompiling we still get lots of garbage values and non decompiled code. The method and the tools used in that article will only allow you to explore the code and get a view on how the code is built and get an idea of the architecture. But you can still get the wholeidea of the decompiled app and can build your own one. About the Glass Camera, I think i have provided a link from ‘AndroidPolice.com’ where they have decompiled and provided some use full information like Intend name which we can call or invoke. If you want more information you can give it a try by decompiling.
      Here is one of their tear down of the Google Glass Apk
      http://www.androidpolice.com/2013/10/16/apk-teardown-latest-google-glass-firmware-gives-a-tantalizing-glimpse-at-a-ton-of-future-features/
      🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s