Can't scan code-128 format as Android Intent

356 views
Skip to first unread message

Mariano Cano

unread,
Nov 28, 2013, 6:04:10 PM11/28/13
to zx...@googlegroups.com

Hi, i'm using the barcode Scanner as an Intent. Using this code:

 Intent intent = new Intent("com.google.zxing.client.android.SCAN");
 intent
.putExtra("SCAN_MODE", "PRODUCT_MODE");
 context
.startActivityForResult(intent, 0);

But It takes too long to recognize the code. But the real problem is that always return a random number, with the wrong format: UPC_E

The strange part is when I start the Barcode Scanner application recognize the barcode quickly and correctly, with format: CODE-128.


 String contents = intent.getStringExtra("SCAN_RESULT");
 
String format = intent.getStringExtra("SCAN_RESULT_FORMAT");



Sean Owen

unread,
Nov 29, 2013, 2:39:14 AM11/29/13
to zx...@googlegroups.com
This scans fine as Code 128 (says 001ade8f466a). What is happening is that you're not successfully scanning it with your phone. Eventually you get a mis-read, and commonly that will be for some phantom UPC-E code.

The reason you are not reading code 128 is right there -- you're scanning for product formats, and Code 128 is not one of those.

Mariano Cano

unread,
Nov 29, 2013, 6:10:26 PM11/29/13
to zx...@googlegroups.com
I removed the line:

intent.putExtra("SCAN_MODE", "PRODUCT_MODE");

And still won't read it.

I've also tried adding this with no luck:

intent.putExtra("SCAN_FORMATS", "CODE_39,CODE_93,CODE_128,DATA_MATRIX,ITF,CODABAR,EAN_13,EAN_8,UPC_A,QR_CODE");

Is there any option that I need to use?

Sean Owen

unread,
Nov 30, 2013, 2:09:37 AM11/30/13
to zx...@googlegroups.com
Why not

intent.putExtra("SCAN_FORMATS", "CODE_128");

Anatoli Kirigwajjo

unread,
Mar 2, 2017, 3:29:03 PM3/2/17
to zxing
On Friday, November 29, 2013 at 11:09:37 PM UTC-8, Sean Owen wrote:
> Why not
>
>
>
> intent.putExtra("SCAN_FORMATS", "CODE_128");

This worked pretty cool for me. Thanks Sean Owen.

Reply all
Reply to author
Forward
0 new messages