B4A Library Barcode Scanner - 100% embedded within B4A (15 Feb 2016 : New library files in Post #105)

Johan Schoeman

Expert
Licensed User
Longtime User
I will have to change the library to accommodate your request. It was like that before but added the functionality to toggle the torch when the scanner is active and touched based on such a request in another scanner that I have posted.
 

rkmoray

Active Member
Licensed User
Longtime User
Any idea when that will happen, or can I use the previous version you were talking about that had that feature?
 

rkmoray

Active Member
Licensed User
Longtime User
1 other question, why are the targeting squares not centered on the ocr(see pic)?
 

Attachments

  • Screenshot_20180321-112439.png
    208.7 KB · Views: 353

Johan Schoeman

Expert
Licensed User
Longtime User

Johan Schoeman

Expert
Licensed User
Longtime User

The attached library files (V1.04) should sort out the torch when the scanner is active and touched. Add the following to your code before starting the scanner:
B4X:
zxslv.ToggleViewTouchTorch = False    'or True
 

Attachments

  • zxScannerLiveView.xml
    12.2 KB · Views: 502
  • zxScannerLiveView.jar
    56.2 KB · Views: 472

Johan Schoeman

Expert
Licensed User
Longtime User
1 other question, why are the targeting squares not centered on the ocr(see pic)?
Can you upload a small sample project that demonstrates the targeting square being out of position. I don't get that on any of my devices.
 

gelay

Member
Licensed User
Longtime User
Hi Johan

The sample project works fine for me, but when I try it to fit in to my project I've got the error below.
Something???
Thanks
Krisztian

B4A Version: 7.30
Parsing code. (0.01s)
Compiling code. (0.16s)
Compiling layouts code. (0.00s)
Organizing libraries. (0.00s)
Generating R file. (0.68s)
Compiling generated Java code. (2.58s)
Convert byte code - optimized dex. Error
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/zxing/BarcodeFormat;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/zxing/Binarizer;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/zxing/BinaryBitmap;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/zxing/ChecksumException;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/zxing/DecodeHintType;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/zxing/Dimension;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/zxing/EncodeHintType;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/zxing/FormatException;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lcom/google/zxing/InvertedLuminanceSource;
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Translation has been interrupted
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:689)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:313)
at com.android.dx.command.dexer.Main.run(Main.java:279)
at com.android.dx.command.dexer.Main.main(Main.java:247)
at com.android.dx.command.Main.main(Main.java:106)
Caused by: java.lang.InterruptedException: Too many errors
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:681)
... 4 more
 

gelay

Member
Licensed User
Longtime User
It's working now two zxing lib loaded parallel...
 

domz

Member
need help please...

first error: support-v4.jar not found ....
so I fix it in xml ...

second error: core-3,0,1.jar not found
I downloaded lib-core-3.1.0.jar in internet ..... I dunno if this is the reason for third error

I change the xml for core-3.1.0 into lib-core-3.1.0


the code runs fine then as I installed and run. the app closed suddenly
then the log says:
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/zxing/DecodeHintType;

howcan I fix it?
my phone model is: Redmi Go
 

Tico.13

Member
Hi to all, im using the zxScanner and its working fine, i just need some help stopping the scanner after obtaining the result and having filled an edittext
This is my code in the zxslv_scanresult event:

zxslv_scanresult event:
Sub zxslv_scanresult
    
    Log(zxslv.ScanResult)
    Label1.Text = zxslv.ScanResult
    'zxslv.RemoveView
    'Activity.Finish

End Sub


Best regards
 

Johan Schoeman

Expert
Licensed User
Longtime User
Something like this:

B4X:
zxslv.Visible = False
zxslv.stopScanner
 

romario87027

Active Member
Licensed User
Longtime User
I inserted the library in my project, I can't understand why it gives me "Scan Error".
B4a Version 10.70!!
 

Johan Schoeman

Expert
Licensed User
Longtime User
I inserted the library in my project, I can't understand why it gives me "Scan Error".
B4a Version 10.70!!
What is the barcode that gives you the error? Can you post it?
 

Johan Schoeman

Expert
Licensed User
Longtime User

romario87027

Active Member
Licensed User
Longtime User
Have you added RuntimePermission for the camera? What is target SDK you have in your B4A manifest?
this is Manifest:
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="30"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.LightTheme)
'End of default text.
CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, FirebaseAnalytics.Firebase)
CreateResourceFromFile(Macro, FirebaseNotifications.FirebaseNotifications)
AddPermission(android.permission.SYSTEM_ALERT_WINDOW)
AddPermission(android.permission.READ_PHONE_STATE)
AddPermission(android.permission.GET_ACCOUNTS)
SetApplicationAttribute(android:usesCleartextTraffic, "true")

'------------------------------------------
AddManifestText(<uses-feature android:name="android.hardware.telephony" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.camera" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.camera.flash" android:required="false" />)
'AddPermission("android.permission.ACCESS_COARSE_LOCATION")
AddPermission("android.permission.INTERNET")
AddPermission("android.permission.ACCESS_FINE_LOCATION")
AddPermission("android.permission.WAKE_LOCK")
AddPermission("android.permission.DEVICE_POWER")
'AddPermission("android.permission.ACCESS_COARSE_UPDATES")
AddPermission("android.permission.READ_PHONE_STATE")
AddPermission("android.permission.VIBRATE")
AddPermission("android.permission.CAMERA")
AddPermission("android.permission.FLASHLIGHT")
AddPermission("android.hardware.camera")
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
 

Johan Schoeman

Expert
Licensed User
Longtime User
Ok. So you have target SDK set to 30. Then you need to add RuntimePermissions to the B4A project code for permission to access the camera. A simple test would be to set the TargetSDK to 22 and see if the camera fires up. You might have to delete the installation of the app on your device before compiling with the SDK in the manifest set to 22.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…