Omkar Amberkar
unread,Jun 14, 2017, 2:41:34 PM6/14/17Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to zxing
Hello, I am trying to create an aztec code with the payload below for android app. However, after feeding this into the aztec generator, I am unable to read this payload after scanning the barcode. The reader linked to Xing says the barcode is invalid.
Has anyone else seen this issue? Or am I generating the Aztec code incorrectly?
Thanks for the help
Take it or leave it
barcode_payload
"i¼\u0000\u0003\u0000\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000)X“}ôZv\u0002ô\u0000\u0000˜\u0012\u0012äNMGX†Ô\u0000\u0001Zv\u0002ô05\u0002\u0018T 64\u0011k\u0007m[\u000f瓉¿RÙƒ¨<úýá‹M\u0002\u0019\u0000 ɼÏØ\u0010Ë¢\u0003d·ã Í\u000bÚæ? Ÿ#+\u0017˜\u0000"
code
public static Bitmap createAztec(String str, int mQrWidth, int mQrHeight, String timestampStr) {
String aztecStr;
if (!TextUtils.isEmpty(timestampStr)) {
aztecStr = str + "|" + timestampStr;
} else {
aztecStr = str;
}
AztecCode aztecCode = com.google.zxing.aztec.encoder.Encoder.encode(aztecStr.getBytes());
BitMatrix matrix = aztecCode.getMatrix();
if (matrix != null) {
int width = matrix.getWidth();
int height = matrix.getHeight();
int[] pixels = new int[width * height];
// All are 0, or black, by default
for (int y = 0; y < height; y++) {
int offset = y * width;
for (int x = 0; x < width; x++) {
pixels[offset + x] = matrix.get(x, y) ? Color.BLACK : Color.WHITE;
}
}
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
bitmap.setPixels(pixels, 0, width, 0, 0, width, height);
return Bitmap.createScaledBitmap(bitmap, mQrWidth, mQrHeight, false);
}
return null;
}