Reputation: 51
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!
Upvotes: 5
Views: 7258
Reputation: 304
Just to share my input using this from HTML anchor element inside Angular 2+ app:
this.callbackUrl = encodeURIComponent(`${currentURL}{CODE}&SCAN_FORMATS=Code 39`);
this.totalBarCodeUrl = `http://zxing.appspot.com/scan?ret=${this.callbackUrl}`;
<a [href]="totalBarCodeUrl"></a>
Upvotes: 0
Reputation: 2353
It works from the default android browser but not the google chrome browser for me
Upvotes: 0
Reputation: 11
Yes trigger it like this:
zxing://scan/?ret=http://192.168.2.9/stock/add.php?barcode={CODE}
Upvotes: 1
Reputation: 66886
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.
Upvotes: 1
Reputation: 102735
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.
Upvotes: 2