Barcode your Android Application

Yesterday evening, my Falafel pals at Microsoft Tech Ed asked for a barcode to display in the Falafel booth so that attendees could easily find Falafel 2 Go in the Android Market.  The popular format for doing this is something called a “QR Code”, a 2 dimensional barcode that can embed links, emails, phone numbers, and other digital media. 

 

At first I was thinking it seemed a bit tedious for an attendee to have to use their camera to find our app in the Android Market.  While the QR Code can be used to embed many types of digital information, it actually happens to be pretty useful for applications in the Android Market.  That is because searching for these applications needs to be done from the Market Application on the mobile device.  It seems pretty lame to have some print media in the booth that says “Go to the Android Market and search for …..”.  The user can also enter the market URL in the Android Browser, but the URL is quite ugly as it contains a query string and the fully qualified package name of the Android app – not the actual product name.  For example, the Market URL for Falafel 2 Go is:

 

market://details?id=com.falafel.android 

 

Don’t click that link, you cannot get there from here!   This will only work on an Android phone because the OS uses something called “Intents” which fire “Activities”.  Even though you are typing this in the phone browser, Android used the protocol specifier (market://) to match an registered Intent, which in this case will decide that the Android Market application should handle this Intent and will execute the Market’s details “Activity” in order to view the product details.  There is another version of the URL that uses the http:// protocol specifier, it looks like this:

 

http://market.adroid.com/details?id=com.falafel.android

 

Entering this into your Android browser results in some new behavior,  you are presented with a dialog asking you if you wish to view this content in the Browser or the Market, because there are multiple Intents available for the http:// protocol.  And by the way, if you choose browser you get the dreaded 404 because the Android Market is not currently directly available to browsers, even the Android Browser!

 

Ok, I give, barcode is nice.  Let’s get on with it.

 

 

Create a QR Code

 

There are many QR Code scanners and generators out there, but Google seems to prefer the ZXing (“Zebra Crossing”) Barcode Library, which is the scanner they have you use by default – we will discuss this later.  QR Code is a standard so you don’t need to use scanners and generators from the same place, but I did choose to use the generator from ZXing which can be found at:

 

http://zxing.appspot.com/generator/

 

 

You can see from the picture above that I generated a QR Code with URL contents.  Also note that I used the market:// protocol, this is because if I had used the http:// version (as I described above) this would end up presenting my user with a choice between Browser (which won’t work - 404) and Market.  I am left to ponder why there is an http:// option at all, possibly for the new Market which has been announced to be available through a regular browser.

 

You can now use this image in any print or electronic media and scanning it from an Android Phone will result in the Market App being launched with your product details page, for a one click download and install.

 

 

Get a barcode reader and scan it!

 

Many different barcode readers will work,  but Google seems to favor the ZXing Library mentioned above.  Apparently some Android devices come with the ZXing Barcode Scanner already installed, mine did not.  The easiest way to get it is to go to http://www.google.com on your mobile device, click “more” at the top, and then click “Shopping”.

 

 

 

 

You will notice that the Google Mobile Shopping site has a “Scan Barcode” option, choosing this will direct you to download and install the ZXing Barcode Scanner if you do not already have it.

 

We can now scan the barcode above and see what happens:

 

 

You are directed to our product details page and can install the application (of course I already have it installed).

 

 

Microsoft Tag

 

Since Falafel does lots of work with Microsoft, I will finish by mentioning that Microsoft has an alternative to QR Codes which they call Microsoft Tag.  This works perfectly well with Android applications as well, since Microsoft does provide a Tag Scanner application for the Android Platform.  Everything behaves essentially as I described above, since Intents and Activities are an essential part of Android.  The Tags and Scanner are just different.  Microsoft Tag has some very nice capabilities, allowing you to integrate your own artwork and branding into the Tag in order to deliver a richer marketing experience.  You can read more about Microsoft Tag at http://tag.microsoft.com

 

 

That’s it, using the above process you can now make your Android Apps findable by QR Code or Tag.

 

 

 

comments powered by Disqus