Android Question [B4XPages][B4X] Barcode QrCode Reader not working

Mike1970

Well-Known Member
Licensed User
Hi everyone i followed this tutorial

I've two Android phone.
1. Honor 8A (Android 9)
2. Meizu 5c (Android 6)

On the first everything works ok, on the second the detector for the codes is not creating... infact it does not pass this check

B4X:
 Dim operational As Boolean = detector.RunMethod("isOperational", Null)
If operational = False Then
        ToastMessageShow("Error creating detector", False)
End If
So.. it will never fire the sub that finds the qrcode/barcode

In the tutorial it is said that it should work for Android 5+

I'm a bit worried because i don't want that on some smartphones (even new) it will not work..

Thanks in advance
 

agraham

Expert
Licensed User
If it doesn't work on that phone then I don't think there is anything you can do about it. Everything obviously compiles fine and runs without error on one phone so the problem has to be in the other phone. How widespread that incompatibility is I don't know but I have six Android 10 and 11 phones that the barcode detection works fine on.
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
If it doesn't work on that phone then I don't think there is anything you can do about it. Everything obviously compiles fine and runs without error on one phone so the problem has to be in the other phone. How widespread that incompatibility is I don't know but I have six Android 10 and 11 phones that the barcode detection works fine on.
Thanks for your feedback agraham
 
Upvote 0

drgottjr

Well-Known Member
Licensed User
according to sources, the meizu m5's software is proprietary and
"based" on android 6.

barcode (vision) software required has to be downloaded from google
(usually the first time you run the barcode reader app.), but there seems
to be an issue regarding the lack of support for google mobile services on the device.

i don't know if you've tried to run the app more than once, but it
has to be online when you do, until the mobile vision software
has been retrieved from play. try again a few times. note:
business at play does not grind to a halt just because mike has
checked in to get his download;). after one failed attempt, i've
come back to my phone a few hours later only to discover that
the software was downloaded while i was away...

another note: i picked up an android knockoff which was
advertised as android 10. tests showed that it was actually
android 6, and - even then - was missing capabilities that an
android 6 was supposed to handle.
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
according to sources, the meizu m5's software is proprietary and
"based" on android 6.

barcode (vision) software required has to be downloaded from google
(usually the first time you run the barcode reader app.), but there seems
to be an issue regarding the lack of support for google mobile services on the device.

i don't know if you've tried to run the app more than once, but it
has to be online when you do, until the mobile vision software
has been retrieved from play. try again a few times. note:
business at play does not grind to a halt just because mike has
checked in to get his download;). after one failed attempt, i've
come back to my phone a few hours later only to discover that
the software was downloaded while i was away...

another note: i picked up an android knockoff which was
advertised as android 10. tests showed that it was actually
android 6, and - even then - was missing capabilities that an
android 6 was supposed to handle.
i thought was something related to Google Services or something similar..
however i tried waiting some time, but nothing changes. it seems to not support this way of detecting qrcodes and barcodes.

probably with libraries a bit more outdated it should work, because downloading an app from the store to read the qrcode it works. so the problem is the approach i think. but in this case i will loose the advantages of the "modern" way to do it.
 
Upvote 0

drgottjr

Well-Known Member
Licensed User
google's mobile vision is not the only way to read barcodes,
but if an app does use it, the required software has to be
downloaded from play, either on installation or the first time
the app is launched (and the user is online). you didn't say,
but it's unclear whether or not the app you downloaded uses
mobile vision.

note: mobile vision is a black box. it works most of the time,
but there is no way to tweak it in the event of a problem.

note II: mobile vision barcode reader uses the zxing software
(which google took over a couple years ago). there are a few
libraries available here which use zxing. i think they're
all written by our resident barcode maven from south africa,
schoermann - i think - is his name. he seems to have spent
a lifetime working with zxing. and fine work it is.

i'm guessing you liked the idea of live barcode reading; if
the zxing libraries don't offer it (it's been a while since i've
looked at them), it shouldn't be difficult to incorporate a
live preview into an app that uses zxing rather than mobile
vision: you capture your preview, convert it to a bitmap and
feed it to zxing. with mobile vision, you capture your preview,
convert it to a "frame" and feed it to mobile vision's reader (zxing).
basically the same flow, same actors, just a different middle step.
 
Upvote 0

Mike1970

Well-Known Member
Licensed User
note II: mobile vision barcode reader uses the zxing software
(which google took over a couple years ago). there are a few
libraries available here which use zxing. i think they're
all written by our resident barcode maven from south africa,
schoermann - i think - is his name. he seems to have spent
a lifetime working with zxing. and fine work it is.
yes i'm pretty sure of this, i think i the past i used it.
the fact is that i developed the app following the suggested (new) ways , and trying on the old phone i found out the problem.

If this will not cause any problem in the future i think i will keep the app as is, in the worst case i will replace the reader with the one of shoermann. The app at the moment is finished and because of deadlines i can't reopen the project now. i hoped for something stupid like an additional libraries that was missing for particular cases or something else in the manifest.

Well thanks drgottjr for the explanation :D
 
Upvote 0

Johan Schoeman

Expert
Licensed User
yes i'm pretty sure of this, i think i the past i used it.
the fact is that i developed the app following the suggested (new) ways , and trying on the old phone i found out the problem.

If this will not cause any problem in the future i think i will keep the app as is, in the worst case i will replace the reader with the one of shoermann. The app at the moment is finished and because of deadlines i can't reopen the project now. i hoped for something stupid like an additional libraries that was missing for particular cases or something else in the manifest.

Well thanks drgottjr for the explanation :D
 
Upvote 0
Top