Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ZXing Barcode Scanner for Webapps

I'm trying to use http://zxing.appspot.com/scan to call Barcode Scanner from a WebApp, but I can't get it to work. Even after needlessly updating and reinstalling it, all it does is show the default zxing webpage that asks me to install Barcode Scanner on my phone. Am I missing something?

Here's the javascript I'm using to call ZXing Scanner. For test purposes, I've even tried to make a simple HTML hyperlink, without success. I'm using Android's WebView to load the app.

window.location.href = 
"http://zxing.appspot.com/scan?ret=http://192.168.1.33:3000/pallet/{CODE}/change_position/"+positionId+"&SCAN_FORMATS=CODE_39";

And this is the Barcode Scanner's manifest that identifies and triggers the scanner through browser:

<intent-filter>
    <action android:name="android.intent.action.VIEW"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <category android:name="android.intent.category.BROWSABLE"/>
    <data android:scheme="http" android:host="zxing.appspot.com" android:path="/scan"/>
</intent-filter>

Funny thing is, http://www.google.com/m/products/scan, that does the same thing, works perfectly. Any help or idea is very welcome! Thanks a lot!

like image 401
Mecer Avatar asked Oct 09 '22 11:10

Mecer


2 Answers

It looks like you're sending a URL to an image on your local network (the 192.168... IP address), which zxing.appspot.com won't be able to access over the Internet.

like image 180
Matthew Crumley Avatar answered Oct 13 '22 11:10

Matthew Crumley


I think I gave some thoughts on the project mailing list, but had another bright idea:

Are you sure you haven't 'saved' your preference for handling this link in the browser? For example when you have a choice of app you're typically asked whether you want to use that app forever to open that kind of link or Intent. Maybe you did that for this link only, and Browser. Go to Applications and "Clear defaults" for all these apps and try again.

like image 38
Sean Owen Avatar answered Oct 13 '22 11:10

Sean Owen