I am using zxing://scan for barcode scanning in my web application for android devices. The phonegap packaging is not acceptable by the user. They want the application to be accessible via browsers only. But as per my understanding, the zxing://scan can't be an Ajax request url.
The only solution which I came through was to window.location.href = zxing://scan/?ret="+escape(window.location.href+"?val={CODE}
which will invoke the android barcode scanner and assign the barcode value to the {CODE} placeholder in the url.
But soon after that the page reloads and all data gets lost. The form is too long with multiple grids. Is there any quick work around to just set the value to the url bar of the browser tab and prevent the triggering of a page reload, other than to store all the data user entered in the session and reloading and setting it back to the form each time the user scans a barcode ?
Please Note: no page reloading & no phonegap plugin is acceptable by the clients. Am I really doomed or is there any solution..?
My second approach is to use the camera tag <input id="demoFile" type="file" accept="image/*;capture=camera">
for taking a photo of barcode, base64 encode & make a post to server side and decode the barcode and get the barcode value from its response.
I know its not the best way for barcode scanning. But I am out of luck due reasons I mentioned above. How do you rate this approach. Is there any better solutions than this ?
Thanks in advance.