QR Scanner

Hello, [member=‘Lerg’];

We’re waiting eagerly for your repair for 2 months.

>> About permissions - I’ll add an event when permission is not granted.

How long should we wait also?

We understand that you’re busy. 

At least, can’t a schedule be specified?

Please mount the minimum function.

I have to agree. After all, this is not free software. It’s a yearly subscription. Having a subscription business model and not maintain/support the software in this way is unfortunate.

In the mean time you can check and re-ask for permissions to the camera yourself creating a utility function ala this:

u.ensureCameraPermission = function(qrFunction) -- Check for camera permission grantedList = system.getInfo("grantedAppPermissions") for k,v in pairs( grantedList ) do if ( v == "Camera" ) then return true end end -- Permission denied. Ask for camera permission local options = { appPermission = "Camera", urgency = "Critical", listener = qrFunction, rationaleTitle = "I need camera access!", rationaleDescription = "The app needs camera access to be able to scan for QR codes. Please give the app access to the camera!", settingsRedirectTitle = "Alert", settingsRedirectDescription = "The app needs camera access to be able to scan for QR codes. Please give the app access to the camera!" } native.showPopup( "requestAppPermission", options ) return false end

Which can be used before the call to the sqscanner ala this:

local function qrMsgListener(e) print("qrMsgListener()") print("Calling: 'qrscanner.show(qrListener)'") waitingForQRScanner = true qrscanner.show(qrListener, { symbols = { 'qr' }, strings = { title = s.str("Scan the QR code!")} }) print("Called: 'qrscanner.show(qrListener)'") end local function qrButtonHandler() if (u.ensureCameraPermission(qrMsgListener) == true) then qrMsgListener() end end

At least that seems to work for my app…

Please, check my code and tell me how to show scanner again after the success reading? Now I’m getting black screen after reading on Android.

local qrscanner = require('plugin.qrscanner') local toast = require('plugin.toast') local function onResult( event ) if ( event.isError ) then toast.show("Network error: ", event.response) else toast.show(event.response) end end local function listener(message) local path = "http://domain.com/check.php?id="..message network.request(path, "GET", onResult) end qrscanner.show(listener)

And what about the Windows platform support? 

I don’t get qrscanner to work with my Nexus 4 test phone running Android 5.1.1. Nothing happens when qrscanner.show() is called. The app has the needed permissions to the camera.

alfred361, on line 6 you can’t use the comma, use two dots instead.

It should probably work calling qrscanner.show() right after line 8. If it doesn’t - try introducing a time delay with timer.performWithDelay().

Windows phone? It’s dead. Windows desktop? How do you imagine that?

runewinse, I am right in the middle of rewriting the Lua interface to have event table with event.isError and event.errorMessage.

On nexus. Nothing even in the logs?

No, nothing in the logs. And the listener function is never called.

Do I have to do something special to enable error messages from the plugin in the logs?

It work once this way. But the second time I’m getting black screen again.

Actually I don’t want to hide video stream at all. I want to show result over the video. Is it possible?

WP is still in use in many countries. And it’s in use on tablets and notebooks.

I can solve this task in Chrome with HTML5 (already did actually), but it would be great to make an app for Windows Store.

One more thing that I can’t test app in Corona Simulator on Win10 without library:

WARNING: The ‘plugin.qrscanner’ library is not available on this platform.

@Lerg - big fan of the QR code scanner. Got an idea where the iPad is wall mounted. is it possible to use the front camera for scans? Could we specify the camera in the options? If you could do that it would be awesome!!!

alfred361, about black screen - please make a small test project and send it over. Plus provide full details - platform, device, os version, a video recording could be helpful as well.
Showing result over video - no, no possible.
Windows Phone has no support for Corona plugins.
And it’s too difficult to make windows or mac plugin.

matt405, I’ll try to support front camera.

@Lerg - thanks. May have a work around - will test later…

if ( system.getInfo( “environment” ) ~= “simulator” ) then
display.setDefault( “cameraSource”, “front” ) – Front-facing camera
–display.setDefault( “cameraSource”, “back” ) – Back-facing camera
end

[quote name=“matt405” post=“354803” timestamp=“1491616141”]@Lerg - thanks. May have a work around - will test later… if ( system.getInfo( “environment” ) ~= “simulator” ) then display.setDefault( “cameraSource”, “front” ) – Front-facing camera --display.setDefault( “cameraSource”, “back” ) – Back-facing camera end[/quote] I doubt this will work, this is designed for source fill object from camera

Scott is right, the plugin doesn’t listen to display.setDefault(“cameraSource”).

Oh…  - any work around you can think of @Lerg?  Really like the idea of expanding our “time management” features with your QR Code scanner, but would only really work through a wall mounted Ipad…

You can open the ipad, drill a hole in the front and rotate the back camera to face front.
Or you can install a periscopic mirror that would direct the light from the front side to the camera module.
You can also open and ipad and rotate the screen, like unfold the tablet. That way both sides become front.

Oh… none of those are really going to work for me… I am sure you can come up with a little API extension… Will be forever grateful…

Big update is coming: regex filter, frontal camera, masking scan area, custom colors for the top bar.
Only a few issues left on iOS.

Awesome news Lerg - rapid work - please let us know when you are ready for us to trial these new features… :slight_smile:

BREAKING CHANGES!!!

Yay! New version is ready.

Read the new docs!

New docs are here: http://docs.spiralcodestudio.com/plugin/qrscanner/
Take a look at the sample code as well.

What’s new.

Change topbar text color.

Change topbar text size.

Change topbar background color.
Apply a mask to the camera, only the area inside the mask will be processed.
Change mask color.
Use regex to filter results.

Use front camera.

Listener receives a normal event table.

Errors are submitted to the listener within the event.

Topbar now can fit long text.

Orientation code has been changed on Android, tell me if it got better.

What’s broken.

Listener now must be provided inside the params table, not as the first argument of the qrcanner.show() function.
Listener now receives an event instead of the message. Message is inside event.message.

New version is tied to the Corona public release - 2017.3068. Use it or a later one.

I expect new bugs to appear. Especially about orientation and masking.