Help to bind Zxing library to scan barcode on Android

LiveCode Builder is a language for extending LiveCode's capabilities, creating new object types as Widgets, and libraries that access lower-level APIs in OSes, applications, and DLLs.

Moderators: LCMark, LCfraser

Post Reply
yunior.portilla
Posts: 24
Joined: Sat May 30, 2020 12:50 am

Help to bind Zxing library to scan barcode on Android

Post by yunior.portilla » Wed Jun 17, 2020 5:42 pm

I'm trying to use the ZXing library from LiveCode Builder to create a barcode reading mechanism, but it doesn't work for me, it must be that I'm doing something wrong.

I am stuck and actually the new LiveCode Barcode Scanner widget requires the Google Play Service functionalities, which makes my app not run on devices that don't have Google Play Service.

In ZXing the IntentIntegrator class is invoked and the initiateScan method is passed to it, that in Android Studio works perfectly for me, raise the camera and scan perfect ...

The results are returned in onActivityResult ... If you could bind these methods from LiveCode Builder awesome. I copied the core and embedded ZXING libraries to the code / jvm-android folder to my LCB project, but it did not work.

yunior.portilla
Posts: 24
Joined: Sat May 30, 2020 12:50 am

Re: Help to bind Zxing library to scan barcode on Android

Post by yunior.portilla » Thu Jun 18, 2020 9:22 pm

I downloaded the .jar from the XZing site and incorporated it into my LCB project at code / jvm-android however when I make the calls it didn't work. I share the code to see where I am failing.

The code has other examples that I put into practice following the basic example of using an external java library.

Thank you.
Attachments
yBarcode.rar
(24.02 KiB) Downloaded 52 times

Klaus
Posts: 12075
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Help to bind Zxing library to scan barcode on Android

Post by Klaus » Fri Jun 19, 2020 8:07 am

Hi yunior,

please only one thread per issue!
Will delete your posting in the ANDROID forum, LivecodeBuilder seems to be the correct forum for this..


Best

Klaus

sphere
Posts: 1097
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Help to bind Zxing library to scan barcode on Android

Post by sphere » Fri Jun 19, 2020 10:26 am

why don't you sideload Google apps on those devices?
That's maybe a simpler solution than the path you try to walk now.
Check https://opengapps.org/ and https://wiki.lineageos.org/gapps.html

It's also used by people who install LineageOS which does not incorporate company's bloatware.

Sometimes you need another loader, and sometimes you can sideload it via an APK. Check and search for Gapps. There are also light versions, just see what you need for the minimum to get it working.

yunior.portilla
Posts: 24
Joined: Sat May 30, 2020 12:50 am

Re: Help to bind Zxing library to scan barcode on Android

Post by yunior.portilla » Thu Jun 25, 2020 6:43 pm

I am obliged for my application to provide a solution independent of Google Play services, lately there are many versions of the operating system that do not have the services of Google Play Service, which means that the excellent Android barcode Widget does not work for me on those devices.

Currently he worked on an educational project that needs to read a Qr code to obtain the student's data, and for example in China Google services are not used so my application does not work there.

Hence my need to find a solution with ZXING as the MergZXing barcode reader variant for IOs that LiveCode has.

In this endeavor I tried to bind liveCode with .arr android-zxing-embbebed.aar but it didn't work for me.

I am preparing an example to share it to see if you can help me.

Regards

yunior.portilla
Posts: 24
Joined: Sat May 30, 2020 12:50 am

[SOlved] Re: Help to bind Zxing library to scan barcode on Android

Post by yunior.portilla » Wed Aug 19, 2020 7:09 pm

I am pleased to share with the community the library with its examples of how to integrate ZXing into LiveCode through LiveCode Builder. Here you have the links to download the example and the library developed that integrates ZXing. It is working very fast for me.

https://github.com/portilla/yBarcode

Regards

sphere
Posts: 1097
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Help to bind Zxing library to scan barcode on Android

Post by sphere » Wed Aug 19, 2020 7:44 pm

This is great!

Downloaded it and will try it out.
So the main advantage is that it is independent of Google dependencies and/or MergZXing ?
But still needs Indy for the camera control.
Correct?

yunior.portilla
Posts: 24
Joined: Sat May 30, 2020 12:50 am

Re: Help to bind Zxing library to scan barcode on Android

Post by yunior.portilla » Wed Aug 19, 2020 8:00 pm

Hello,

If the library is totally independent of Google and mergZXing, precisely what I did was integrate the free ZXing project in the library that I developed with LiveCode Builder so that I did not need anything to read a Qr code.

Previously LiveCode brings a library to generate Qr codes but not to read them, this library solves that problem and without depending in the case of Android on Google Play services.

Unfortunately in the community version the methods to manipulate the camera internally are not available as they appear in the Indy version with the "CameraControl", in the example there is that complete integration. For now I am working on a widget that will raise the device's camera through the android SDK so that in the community version I can also use the second example.

Thank you

sphere
Posts: 1097
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Help to bind Zxing library to scan barcode on Android

Post by sphere » Wed Aug 19, 2020 9:12 pm

Hi Portilla,

wow that sounds great!

I just tested it on my Android phone and it works great! When I scan with the camera it gives the nr's of the QR-code. It's fast too.

I hope you are wanting to show how you integrated it via lcb, so that we can learn from it too. As many people still have many questions on how to integrate Android sdk stuff or AAR's into lcb.

Fantastic Job!

thanks a lot.

PaulDaMacMan
Posts: 324
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: Help to bind Zxing library to scan barcode on Android

Post by PaulDaMacMan » Thu Aug 20, 2020 11:30 pm

Bravo!
It would be really great if you'd release the source .lcb file too as there isn't all that many examples of using LCB with JAVA around.
Thanks for releasing this.
My LCB Repos: https://github.com/PaulMcClernan/

SparkOut
Posts: 2318
Joined: Sun Sep 23, 2007 4:58 pm

Re: Help to bind Zxing library to scan barcode on Android

Post by SparkOut » Fri Aug 21, 2020 7:29 am

Well done! Thank you for this.
I would also love to see the lcb source, I am sure many other people would be grateful for this as well.
It is a big step from making the pink ball widget to a FFI interface, and this real-world example would be a fantastic way to expand the user base competence.

yunior.portilla
Posts: 24
Joined: Sat May 30, 2020 12:50 am

Re: Help to bind Zxing library to scan barcode on Android

Post by yunior.portilla » Fri Aug 21, 2020 3:43 pm

Hello,

I am happy to share the LiveCode Builder source code with you and the community. At the moment if they have accounts in gitlab they send me the user here and I add them as members to the project that I have of yBarcode in gitLab so they can see what is done.

Excuse my English because I am Spanish speaking.

I have not completely released the code to work on the part of the widget that will integrate the camera and make the project much more complete.

Although it is already a step forward to have a library that reads the qr code from an image.

Regards.

Post Reply

Return to “LiveCode Builder”