だから私があなたが欲しいと思うのは、バイト配列の生のデコードされたデータです。zxingが提供するインテントソースにはメタデータがありませんが、それでもインテントフィルターに送信されています。
IntentIntegrator.java内のparseActivityResultに、以下を追加できます。
byte[] dataBytes = intent.getByteArrayExtra("SCAN_RESULT_BYTE_SEGMENTS_0");
return new IntentResult(contents,
formatName,
rawBytes,
orientation,
errorCorrectionLevel,
dataBytes);
IntentResultクラスを変更して、この余分な部分を取得できるようにしました。
private final byte[] dataBytes;
IntentResult() {
this(null, null, null, null, null, null);
}
IntentResult(String contents,
String formatName,
byte[] rawBytes,
Integer orientation,
String errorCorrectionLevel,
byte[] dataBytes) {
this.contents = contents;
this.formatName = formatName;
this.rawBytes = rawBytes;
this.orientation = orientation;
this.errorCorrectionLevel = errorCorrectionLevel;
this.dataBytes = dataBytes;
}
/**
* @return raw content of barcode in bytes
*/
public byte [] getDataBytes() {
return dataBytes;
}
このバイト配列は、メタデータの最初の配列、つまりデータの生のコンテンツをバイト単位で格納します。