From 27445b32cd740ecbb19bc3e8d158461220c1a10a Mon Sep 17 00:00:00 2001 From: srowen Date: Wed, 9 Mar 2011 20:41:52 +0000 Subject: [PATCH] Issue 740 user-suggested patch to return bytes git-svn-id: https://zxing.googlecode.com/svn/trunk@1724 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- .../com/google/zxing/client/android/CaptureActivity.java | 4 ++++ android/src/com/google/zxing/client/android/Intents.java | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/android/src/com/google/zxing/client/android/CaptureActivity.java b/android/src/com/google/zxing/client/android/CaptureActivity.java index c52fc587c..bfe38f601 100755 --- a/android/src/com/google/zxing/client/android/CaptureActivity.java +++ b/android/src/com/google/zxing/client/android/CaptureActivity.java @@ -532,6 +532,10 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); intent.putExtra(Intents.Scan.RESULT, rawResult.toString()); intent.putExtra(Intents.Scan.RESULT_FORMAT, rawResult.getBarcodeFormat().toString()); + byte[] rawBytes = rawResult.getRawBytes(); + if (rawBytes != null && rawBytes.length > 0) { + intent.putExtra(Intents.Scan.RESULT_BYTES, rawBytes); + } Message message = Message.obtain(handler, R.id.return_scan_result); message.obj = intent; handler.sendMessageDelayed(message, INTENT_RESULT_DURATION); diff --git a/android/src/com/google/zxing/client/android/Intents.java b/android/src/com/google/zxing/client/android/Intents.java index 6605baf79..7f72ddf49 100755 --- a/android/src/com/google/zxing/client/android/Intents.java +++ b/android/src/com/google/zxing/client/android/Intents.java @@ -93,6 +93,12 @@ public final class Intents { */ public static final String RESULT_FORMAT = "SCAN_RESULT_FORMAT"; + /** + * Call intent.getByteArrayExtra(RESULT_BYTES) to get a {@link byte[]} of raw bytes in the + * barcode, if available. + */ + public static final String RESULT_BYTES = "SCAN_RESULT_BYTES"; + /** * Setting this to false will not save scanned codes in the history. */