ZXing Barcode Scanner Purpose: Set DecodeHintType.ASSUME_GS1

In my application, I want to scan the GS1-128 barcode and you need the FNC1 characters passed from the ZXing barcode scanner. Right now, I'm just getting plain text without the characters FNC1.

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

I do not want to include the full source of the scanner in my application and, rather, use the intent.

In the scanner source code, I see that the DecodeHintType parameter should be set to: 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 entire network and did not find an answer to this. It drives me crazy...

+3
source share
2 answers

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

 intentScan.putExtra("ASSUME_GS1", true); 

Tips can be set using additional features. I just had to figure it out, because I couldn't find anywhere else to do it.

I downloaded the barcode scanner code and debugged a bit. But now I can use the original application and get the barcode through Intent. :-)

+3
source

Yes, this is the clue you need. It will return FNC1 as ASCII 29. There is no general way to pass Intent hints, but some of them are supported as additional Intent options. If you want to send a patch that triggers this hint, I'll take a look.

+2
source

Source: https://habr.com/ru/post/977905/


All Articles