2010-08-13

Scan, Convert, Share using Android and ZXing


So, I had been looking for an easy way to scan a barcode and then share it as a QR Code (even if the original was in a different format). After a while going through several different applications with no luck, I finally realized what I could do.

The ZXing barcode scanner has a "custom search" feature that allows entering a custom URL for searching. I didn't think that I had any use for it, until I realized that I could use it to easily convert data read from a barcode into QR Code format.

Basically, all I did was utilize the same thing that's used by ZXing's online QR Code generator.
Here's how:
  1. Open the Barcode Scanner application.
  2. Tap the phone's Menu Key.
  3. Tap the "Settings" option.
  4. Tap the "Custom search URL" item (you might need to scroll down first).
  5. Fill in the box with: "http://chart.apis.google.com/chart?cht=qr&chs=300x300&chl=%s" (not including the quotes).
  6. Go back and scan something.
  7. Press the "Custom Search" option.
  8. See below.
Notes:
  • The "300x300" part is the size; I found this to be a good size on my Droid Incredible, but you can change it as needed. (It should remain a square, though.)
  • It doesn't like the "%" (percent) symbol. I haven't found an easy way around this, but I'm sure it could be put into the generator box directly using JavaScript; I just haven't taken the time to figure it out. (Let me know if you do, so I can link to it!)
  • If you scan something that contains a percent symbol, and it's not working properly, replace the "%" in the URL it directs you to with "%25"; then it should work.
Feel free to comment with tips/tricks/improvements, a better way of doing it, or just to let me know you read this post.

2 comments:

Barcode Market said...
This comment has been removed by a blog administrator.
Unknown said...
This comment has been removed by a blog administrator.