Search code examples
javaandroidbarcodehandheldpdf417

Parse input from PDF417 built-in reader Android device


Well first of all, I'm learning coding.

I am using Android Studio 3.1.3, Java, API level 22 (For Android OS 5.1)

I need to code an Android app that´ll capture data read from PDF417 that's on people's IDs in my country. Its a people access control app, so you come to a place and they read your ID and get some data saved on the device, to authorize or deny access to the place. Its and offline app, that´ll save data into a local SQLite database.

For this I'm using a Newland MT6550 device which has a built-in 1D and 2D Imager Scanner. So the device can read the PDF417 and a wide range of other barcodes (So, I do not need to create a reader app).

I need to parse the input of the PDF417 into several data Strings like Name, ID n°, date and serial code. All of which are stored in the PDF417 in what to me is an unknown format (or encoding?).

The problem is, that when I read the PDF417 with the scanner, it writes several unrecognizable characters (like the '?' inside a diamond, and Chinese or Korean characters) on the EditText, which is where im getting the code input, and I cant´t parse that, and also it doesn´t give me all the data.

Is there a way to set up the input so it gives me something I can work with? Maybe a String without the '?' or an XML file I can read and separate into the Strings of data I need. (Which I know how to do)

TL;DR: I need to parse data input from PDF417 built-in scanner Android device, capture that input into my app, and save data from it.

Here is an example of the resulting data:

178023954111605108 GARC虯 CHL280618A02375463812 � PC1悇o@?h<}r皩z苝u祑偲歝頺b~L哖乺嵟e潔疂Q鋂o堡Rj_尯畬筍1]�:祪臽樐挙|甂醃暵洠燫嫻VM焤┫篟a耼觟ㄊEz硠.鮡〩�0m槺棷Φw碨莿M0�?Qじ9�絀ω挄� /聾,盼3裐?EABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghij


Solution

  • Contacted Newland, they sent an updated SDK manual which included the Encoding setting for the scanner. Changing the encoding I was able to get and correctly parse the data from the IDs. The app is done and im getting paid for coding for the first time! yay!