Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.3k views
in Technique[技术] by (71.8m points)

android - ZXing Barcode Scanner Intent: set DecodeHintType.ASSUME_GS1

In my app I want to scan a GS1-128 barcode, and need the FNC1 characters passed from the ZXing barcode scanner. Right now I just receive the plain text without the FNC1 characters.

Is there a way to pass the DecodeHintType.ASSUME_GS1 via Intent to the scanner app?

I don't want to include the complete scanner source in my app and rather use the Intent.

In the source code of the scanner I can see that the DecodeHintType needs to be set to achive that: https://code.google.com/p/zxing/source/browse/trunk/core/src/main/java/com/google/zxing/oned/Code128Reader.java

 boolean convertFNC1 = hints != null && hints.containsKey(DecodeHintType.ASSUME_GS1);

Thanks for any help. I searched almost the whole web and didn't find an answer to this. This is driving me nuts...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

At the end it turned out that it was easier than I thought:

intentScan.putExtra("ASSUME_GS1", true);

The hints can be set with extras. I just had to figure it out, because I couldn't find it anywhere how to do that.

I downloaded the code of the Barcode Scanner and did a little debugging. But now I can use the original app and get the barcode via Intent. :-)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...