QR Scanner

and callback not getting called

Lerg, I just discovered another slight issue with the scanner. It could be that this behaviour is a setting, but I couldn’t find any mention of it in the docs.

I use a mask to scan a narrow area when scanning for barcodes (this is very handy when there are several codes in the area and you want one specific). The problem arises when such a barcode is vertical on an object that is not easy to move. This makes the mask area going in the wrong direction. If I then rotate the phone, the scanner also rotates and I’m back where I started.

I have tried to show it here:

https://youtu.be/ERyvzXrZaTU

To make things even more confusing the screen video recorder also rotates with the phone. Sorry about any nausea…

Maybe you could add a parameter not to rotate with the phone for these cases?

Thanks!

Sorry, who help me?

runewinse, I can disable rotation. Hm, by default or on a request?

pclex01, use at least 2017.3068 version of Corona.

As a rule of thumb - when something is not working - try the latest daily and the last public release. 

Hi Support,
 
I have a problem with the QR scanner but not really sure if it is related to the plugin or is it my problem. Here is the flow:
 

  1. User click on a button to fire a function to call the “qrscanner.show”

  2. The listener of the scanner will read the result and call network.request to send the QR code content to a remote server

  3. When the network.request has response, my app will fire a runtime event to tell the app to show the related screen
     
    However, I found some records on the remote server are duplicated with completely the same timestamp. It means the “Network.request” has been fired more than once in the scanner listener.
     
    Below is the code I used:
     
     

    function openScanner(event)   local qrscanner = require(‘plugin.qrscanner’)   local function listener(event)     – Save QR code to web local URI    = _G.__webRoot … ‘api/somewhere.php’   local METHOD = “POST” local PARAMS = {} local strData = “” strData = ‘qr=’…urlencode(event.message)     strData = strData … ‘&memberId=’…urlencode(_G.memberId) PARAMS.body = strData   network.request( URI, METHOD, qrResponse, PARAMS)   end   local qrOptions = { strings = { title = _G.__uiText[_G.appLang][‘lblQRCodeReader’] }, } qrscanner.show{listener = listener}   end

Good question. I’ve thought about it and for barcodes I cannot come up with any reason to autorotate by default. For QR codes default autorotate could maybe be of use if the app is working in a horizontal way before envoking the qr scanner…

But it’s all the same to me. I’m happy if there is a way to turn off the auto-rotation :slight_smile:

Have you tried logging along the way to make sure this is what happens?

Hi runewinse,

I just tried to add a flag to prevent multiple network.request to fire at the same time. Hope this will help. Actually, I can’t duplicate the problem myself but I saw some duplicated records in my remote server.

I just want to make sure that is the QR scanner listener fired once only after the scan?

Thanks!

apps30, hi, the listener doesn’t fire twice. Place a print statement in your code before network.request(). You can also insert your own time token in the request and compare against that.

Any luck with this one yet?

runewinse, I’ve scheduled the bug fixing for the weekend. I hope that’s fine?

That’s great. Thanks!

How did it go?

I think Android version is done. Working on iOS version.

Done as in ready for testing by me? Or do both versions have to be finished before you release it?

BTW: Great work! (I hope)

I need to finish both.

Okey dokey. I’ll hold on then.

I am having a trouble implementing the orientation feature on iOS, I’ve decided to postpone it.

But I updated the Android version.

UTF-8 issue should be fixed and orientation should not change when you start the scanner.

Ok, I can live with that for a while. Is the UTF8 issue fixed also for the iOS? Or maybe it never was a problem?

runewinse, on iOS it wasn’t a problem.