Touchkit reading QR codes

Hi,
Im trying to read text plain qr codes with Touchkit. My idea is to work with something similar to the parking demo, but instead of taking a picture with the mobile camera I wish to call some qr scanner and use that code later on. Is it possible to call a native android application using Touchkit and receive a result from that application?

Hi,


This technique
works in Android to launch the QR code reader from a web page, and then return the result in a HTTP query. I think it should work with Vaadin applications as well. The callback HTTP request could be processed in the servlet…or in some other way such as a RequestHandler, haven’t tried how to do it.

Hi Marko, thanks for your propt reply.

The strategy you have suggested seems fine to me and could do the job. I tried to apply it by following the scanner url with my url parameters (http://zxing.appspot.com/scan…), if I enter the code by hand I am redirected properly to my vaadin application. However the scanner webpage keeps propmting me to install the scanner application in android, so that I can´t read any qr code as desired, only enter codes by keyboard. I should see how to solve this.

Is there any other way to directly integrate zxing library with my touchkit application? Can I use android’s intent and activity to interact with the scanner in the client side?

There was also the “xzing://…” notation, but I suppose it doesn’t work either if the specific app isn’t installed. I suppose I had it installed so it worked.

I don’t know more about the topic on Android, it’s not really a Vaadin-specific issue. Nevertheless, it would be good to have a robust working solution for that.

Hi Maximiliano,
You succeeded in

QR code reading

with Touchkit? I’m very interested in how it goes and if you completed it, would you like to share it how? I’m now stuck with something similiar with

QR code

issue. Thanks in advance.

Makaveil

Yeah, it finally worked for me using zxing. I was having issues with the installed scanner on Android but now woks fine, though not quite sure what was going wrong.

It’s quite simple, you must open a link like:

getUI().getPage().open("http://zxing.appspot.com/scan?ret=http%3A%2F%2Fxxx.xxx.xxx.xxx:8090%2FpasosMovil%2F%3Fbarcode%3D%7BCODE%7D&SCAN_FORMATS=CODE_128", null, false);

bying xxx.xxx.xxx.xxx:8090 my ip, “pasosMovil” the application UI and “barcode” the expected code parameter.

So when you choose to read a code you leave your site and the scanner is opened (you are prompt to install the requiered scanner if you don’t have it yet). Once the code is read you are redirected again to your webpage with the desired code.
Then in the main UI I read the code as:

    @Override
    protected void init(VaadinRequest request) {
        ...
        String strBarcode = request.getParameter("barcode");                              
        if (strBarcode != null){
            //do something
        }
        ...
}

In my case I’m just reading barcodes, but you can select other options by looking at http://goo.gl/8wj40 which is a testing page. Obviously I would prefer another kind of approach which doesn´t rely on this external tools, but for the time being it solved my problem. Maybe some kind of phonegap integration could help.