Spelt / ZXing.Delphi

ZXing Barcode Scanning object Pascal Library for Delphi VCL and Delphi Firemonkey
Apache License 2.0
479 stars 204 forks source link

Scanner does not scan #17

Closed FrankFinken closed 8 years ago

FrankFinken commented 8 years ago

Hi,

I'm new to android programming and I downloaded the ZXing.Delphi-master zip file. The test application compiled fine and starts on my S4, but the scanner does not read valid barcodes. The ReadResult in GetImage is always nil. I have set the focus mode as suggested in the oncamerclick (CameraComponent1.FocusMode := TFocusMode.ContinuousAutoFocus;)

For the rest the app is as downloaded. What am I missing/doing wrong here? Any help is greatly appreciated.

Delphi version is XE 10.1

Regards, Frank

Spelt commented 8 years ago

Hi

What version of Delphi do you use? Does the camera seems in focus? Is the picture clear?

2016-06-01 0:18 GMT+02:00 FrankFinken notifications@github.com:

Hi,

I'm new to android programming and I downloaded the ZXing.Delphi-master zip file. The test application compiled fine and starts on my S4, but the scanner does not read valid barcodes. The readresult in GetImage is always nil. I have set the focus mode as suggested in the oncamerclick (CameraComponent1.FocusMode := TFocusMode.ContinuousAutoFocus;)

For the rest the app is as downloaded. What am I missing/doing wrong here?

Any help is greatly appreciated.

Regards, Frank

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Spelt/ZXing.Delphi/issues/17, or mute the thread https://github.com/notifications/unsubscribe/AMEt1RLVaC7L8LAtscCNukYQ7WK5UJzzks5qHLPLgaJpZM4IrA3p .

FrankFinken commented 8 years ago

Hi,

thanks for your reply.

I'm using Delphi XE 10.1 The picture is clear and focussed. The ZXing barcode scanner app can read the barcodes.

FrankFinken commented 8 years ago

Tonight I will try using XE8.

Spelt commented 8 years ago

Did not test it on 10.1 But did test it on 10 (Seattle).

2016-06-01 14:29 GMT+02:00 FrankFinken notifications@github.com:

Tonight I will try using XE8.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Spelt/ZXing.Delphi/issues/17#issuecomment-222977523, or mute the thread https://github.com/notifications/unsubscribe/AMEt1aL_QBC7JU_2oImBledUfQD9JzcEks5qHXs7gaJpZM4IrA3p .

FrankFinken commented 8 years ago

If I build on my XE8 environment it also does not work. When I use intent code I can scan, but then I need the extenal scanner app.

var LIntent: JIntent; begin // set OnActivityResult message handler FMessageSubscriptionID := TMessageManager.DefaultManager.SubscribeToMessage(TMessageResultNotification, HandleActivityMessage);

// launch Barcode Scanner in SCAN mode LIntent := TJIntent.JavaClass.init(StringToJString('com.google.zxing.client.android.SCAN')); LIntent.setPackage(StringToJString('com.google.zxing.client.android')); LIntent.putExtra(StringToJString('SCAN_MODE'), StringToJString('ONE_D_MODE,QR_CODE_MODE,PRODUCT_MODE,DATA_MATRIX_MODE'));

SharedActivity.startActivityForResult(LIntent, SCAN_REQUEST_CODE);

Spelt commented 8 years ago

Hi Frank

There should be no need for this ugly code ;-) I do not have a S4 over here but on my androids it just works.

Could you zip the code and post it? Then I can take a closer look.

Op 3 jun. 2016, om 14:08 heeft FrankFinken notifications@github.com het volgende geschreven:

If I build on my XE8 environment it also does not work. When I use intent code I can scan, but then I need the extenal scanner app.

var LIntent: JIntent; begin // set OnActivityResult message handler FMessageSubscriptionID := TMessageManager.DefaultManager.SubscribeToMessage(TMessageResultNotification, HandleActivityMessage);

// launch Barcode Scanner in SCAN mode LIntent := TJIntent.JavaClass.init(StringToJString('com.google.zxing.client.android.SCAN')); LIntent.setPackage(StringToJString('com.google.zxing.client.android')); LIntent.putExtra(StringToJString('SCAN_MODE'), StringToJString('ONE_D_MODE,QR_CODE_MODE,PRODUCT_MODE,DATA_MATRIX_MODE'));

SharedActivity.startActivityForResult(LIntent, SCAN_REQUEST_CODE);

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Spelt/ZXing.Delphi/issues/17#issuecomment-223562213, or mute the thread https://github.com/notifications/unsubscribe/AMEt1adkccdAK55-NChmR-CA1P9mtB_Oks5qIBkygaJpZM4IrA3p.

Spelt commented 8 years ago

Question: How do the unit tests work?

Hi Frank

There should be no need for this ugly code ;-) I do not have a S4 over here but on my androids it just works.

Could you zip the code and post it? Then I can take a closer look.

Op 3 jun. 2016, om 14:08 heeft FrankFinken <notifications@github.com mailto:notifications@github.com> het volgende geschreven:

If I build on my XE8 environment it also does not work. When I use intent code I can scan, but then I need the extenal scanner app.

var LIntent: JIntent; begin // set OnActivityResult message handler FMessageSubscriptionID := TMessageManager.DefaultManager.SubscribeToMessage(TMessageResultNotification, HandleActivityMessage);

// launch Barcode Scanner in SCAN mode LIntent := TJIntent.JavaClass.init(StringToJString('com.google.zxing.client.android.SCAN')); LIntent.setPackage(StringToJString('com.google.zxing.client.android')); LIntent.putExtra(StringToJString('SCAN_MODE'), StringToJString('ONE_D_MODE,QR_CODE_MODE,PRODUCT_MODE,DATA_MATRIX_MODE'));

SharedActivity.startActivityForResult(LIntent, SCAN_REQUEST_CODE);

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Spelt/ZXing.Delphi/issues/17#issuecomment-223562213, or mute the thread https://github.com/notifications/unsubscribe/AMEt1adkccdAK55-NChmR-CA1P9mtB_Oks5qIBkygaJpZM4IrA3p.

tcyhaveto commented 8 years ago

@FrankFinken Maybe you need change the Camera Quality Model as the following code: CameraComponent1.Quality:=TVideoCaptureQuality.MediumQuality;

Rafdev86 commented 8 years ago

Hi I'm using Delphi XE 10 Seattle

when I add : CameraComponent1.FocusMode := TFocusMode.ContinuousAutoFocus; I get the following error : delphi java.lang.runtimeexception: setparameters failed.

Thanx for your help.

Spelt commented 8 years ago

Hi

Sounds not like a ZXing but a TCameraComponent issue. Try the TCameraComponent in a stand alone application or try the demo application first.

2016-06-08 12:08 GMT+02:00 Rafdev86 notifications@github.com:

Hi I'm using Delphi XE 10 Seattle

when I add : CameraComponent1.FocusMode := TFocusMode.ContinuousAutoFocus; I get the following error : delphi java.lang.runtimeexception: setparameters failed.

Thanx for your help.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Spelt/ZXing.Delphi/issues/17#issuecomment-224546461, or mute the thread https://github.com/notifications/unsubscribe/AMEt1cJLF_OB4lGwnHEM3lxT0DuLgaC_ks5qJpSigaJpZM4IrA3p .

Rafdev86 commented 8 years ago

Hi Spelt,

I tested the TCameraComponent in a stand alone application with the TFocusMode I got the same error. Is there another solution to enable the TFocusMode?

Spelt commented 8 years ago

To be honest, I never encountered this error before. Which Android hardware do you use?

Few options to try:

1)

There is a bug in the TCameraComponent (XE7/XE8/10) which causes the Android camera not to autofocus at all and therefore crippels the barcode scanning. There is a work around which can be found here: https://translate.google.nl/translate?sl=auto&tl=en&js=y&prev= _t&hl=nl&ie=UTF-8&u= http://tacotony.pixnet.net/blog/post/105520991-xe6%E7%82%BAtcameracomponent%E5%85%83%E4%BB%B6%E5%8A%A0%E4%B8%8A%E5%B0%8D%E7%84%A6%E5%8A%9F%E8%83%BD&edit-text=

2) This project, https://github.com/gmurt/KernowSoftwareFMX is pretty neat also and has maybe aTCameraViewer that you can use. I dont know if this helps though but you can try the demo pretty quickly.

2016-06-08 15:25 GMT+02:00 Rafdev86 notifications@github.com:

Hi Spelt,

I tested the TCameraComponent in a stand alone application with the TFocusMode I got the same error. Is there another solution to enable the TFocusMode?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Spelt/ZXing.Delphi/issues/17#issuecomment-224587808, or mute the thread https://github.com/notifications/unsubscribe/AMEt1dO9Y7ms8AMtM5eWBNFNmv7I5VKCks5qJsLkgaJpZM4IrA3p .

Rafdev86 commented 8 years ago

Hi Spelt,

I use Android 5.1.1 (API 22). Delphi XE 10 Seattle. I tried the option 1, I had the same problem (I may be wrong tried). Option 2, it doesn't contain TCameraViewer demo.

Spelt commented 8 years ago

He has a component though which is easy to setup.

Your TCameraComponent seems pretty weird: maybe you are suffering from:

There is a bug in the TCameraComponent (XE7/XE8/10) which causes the Android camera not to autofocus at all and therefore crippels the barcode scanning. There is a work around which can be found here: https://translate.google.nl/translate?sl=auto&tl=en&js=y&prev= _t&hl=nl&ie=UTF-8&u= http://tacotony.pixnet.net/blog/post/105520991-xe6%E7%82%BAtcameracomponent%E5%85%83%E4%BB%B6%E5%8A%A0%E4%B8%8A%E5%B0%8D%E7%84%A6%E5%8A%9F%E8%83%BD&edit-text=

2016-06-09 12:03 GMT+02:00 Rafdev86 notifications@github.com:

Hi Spelt,

I use Android 5.1.1 (API 22). Delphi XE 10 Seattle. I tried the option 1, I had the same problem (I may be wrong tried). Option 2, it doesn't contain TCameraViewer demo.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Spelt/ZXing.Delphi/issues/17#issuecomment-224852284, or mute the thread https://github.com/notifications/unsubscribe/AMEt1R1jSqRGzT-X3dHP_pxwiEyCE9KWks5qJ-TzgaJpZM4IrA3p .

maurobotta commented 8 years ago

I'm using Berlin on HTC One Max and Samsung S6 and aTestApp demo don't work

ReadResult in GetImage is always nil in ZXing.Delphi V 3.1

i can see image on my app and "***" chars, but scanner don't read simple ean13 bar code

vclTestApp demo don't work for me, always scan result: "Unreadable!"

Spelt commented 8 years ago

Hi Mauro,

Unfortunately ean is not supported at this time. There was some work done but its not completed.

Sincerely, Edward

Op 5 sep. 2016 om 12:32 heeft Mauro Botta notifications@github.com het volgende geschreven:

I'm using Berlin on HTC One Max and Samsung S6 and aTestApp demo don't work

ReadResult in GetImage is always nil in ZXing.Delphi V 3.1

i can see image on my app and "***" chars, but scanner don't read simple ean13 bar code

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.