Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

QR Scanner
Started by Michael W. Aug 12 2015 01:53 PM

368 replies to this topic
release android ios
[TOPIC CONTROLS]
« Page 15 of 15 13 14 15
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#351

runewinse

[GLOBAL: userInfoPane.html]
runewinse
  • Contributor

  • 485 posts
  • Corona SDK

Lerg, I have a request (if it's not done already).

 

Could you please implement a way to handle the situation when the app does not have a camera permission? Either ask the user directly to change the permission (don't know if this is possible in iOS) or just a message (customizable of course) telling the user that he has to give camera permissons to the app.

 

Thanks!



[TOPIC: post.html]
#352

runewinse

[GLOBAL: userInfoPane.html]
runewinse
  • Contributor

  • 485 posts
  • Corona SDK

I have recently discovered that some QR codes does not seem to be recognized by the QR scanner.

 

I use the QRGenerator library (https://forums.coronalabs.com/topic/65821-qrgenerator-for-corona/) to generate QR images for sharing data between devices and one of the QR images looks like the attached png file.

 

Attached File  qr not recognized.png   158.18KB   2 downloads

 

The data that was generated in this JSON-encoded data:

{"l":44,"w":[{"a":"one","b":"en"},{"a":"two","b":"to"},{"a":"three","b":"tre"},{"a":"four","b":"fire"},{"a":"five","b":"fem"},{"a":"six","b":"seks"},{"a":"seven","b":"sju"},{"a":"eight","b":"åtte"},{"a":"nine","b":"ni"},{"a":"ten","b":"to"},{"a":"eleven","b":"elleve"},{"a":"twelve","b":"tolv"},{"a":"thirteen","b":"tretten"},{"a":"fourteen","b":"fjorten"},{"a":"fifteen","b":"femten"}],"n":"test123"}

When using QR scanner this image doesn't seem to be recognized as a QR code at all, but the app QR Droid doesn't seem to have any problems with it:

 

 

 

The docs doesn't seem to be available anymore, so I cannot check, but have only used a simple 'qr' in the symbol list and it usually works well.

  qrscanner.show { listener = qrListener,
                   symbols = { 'qr' },
                   strings = { title = s.str("Scan the QR code!") } }

Do you have any explanation why the attached QR image is not readable?



[TOPIC: post.html]
#353

runewinse

[GLOBAL: userInfoPane.html]
runewinse
  • Contributor

  • 485 posts
  • Corona SDK

I tried the full symbol list also, but it did not make any difference:

  qrscanner.show { listener = qrListener,
                   symbols = { 'aztec', 'code39', 'code39mod43', 'code93', 'code128', 'codabar', 'databar', 'databar_exp', 'datamatrix', 'ean8', 'ean13', 'interleaved2of5', 'itf14', 'i25', 'isbn10', 'isbn13', 'partial', 'pdf417', 'upca', 'upce' },
                   strings = { title = s.str("Scan the QR code!") } }


[TOPIC: post.html]
#354

Lerg

[GLOBAL: userInfoPane.html]
Lerg
  • Contributor

  • 533 posts
  • Corona Staff

Link to the docs is here http://docs.spiralcodestudio.com/plugin/qrscanner/



[TOPIC: post.html]
#355

runewinse

[GLOBAL: userInfoPane.html]
runewinse
  • Contributor

  • 485 posts
  • Corona SDK

At first I thought maybe there was some upper limit to the complexity of the QR code, but this one scans just fine:

 

Attached File  qr recognized.png   19.57KB   1 downloads

 

And that is more complex than the problematic one.

{"l":44,"w":[{"a":"snake","b":"slange"},{"a":"monkey","b":"ape"},{"a":"donkey","b":"esel"},{"a":"duck","b":"and"},{"a":"armadillo","b":"beltedyr"},{"a":"platypus","b":"nebbdyr"},{"a":"sheep","b":"sau"},{"a":"horse","b":"hest"},{"a":"goat","b":"geit"},{"a":"frog","b":"frosk"},{"a":"cat","b":"katt"},{"a":"dog","b":"hund"},{"a":"turtle","b":"skilpadde"},{"a":"fox","b":"rev"},{"a":"seal","b":"sel"},{"a":"roaster","b":"hane"},{"a":"rabbit","b":"hare"},{"a":"eagle","b":"ørn"},{"a":"toad","b":"padde"},{"a":"unicorn","b":"enhjørning"}],"n":"test123"}

So I don't see any pattern to this!



[TOPIC: post.html]
#356

runewinse

[GLOBAL: userInfoPane.html]
runewinse
  • Contributor

  • 485 posts
  • Corona SDK

I think that maybe there is something wrong with the QR generator, because I've tried with a few scanners and most of them have problems with the "problem image", even though QR Droid worked ok.

 

Problem is that I cannot get hold of the author  :huh:



[TOPIC: post.html]
#357

CyberCatfish

[GLOBAL: userInfoPane.html]
CyberCatfish
  • Enthusiast

  • 58 posts
  • Corona SDK

I have created an application for several years using QRScanner.

I have done public events such as stamp rally many times in the suburbs of Tokyo, but no major problems have occurred.

 

However, if there is much data like runewinse, reading and printing are greatly affected by printing and display.

Besides, there is a fear that the data may be falsified by the prankster.

So I have included only the URL in the code.

The body of the data is downloaded with the key from the URL.

If you access the URL by another application, this ad for this event will be displayed.

And you do not have to read other QR codes by filtering the first part of the URL.

 

However, I still have incomplete error handling in the latest application.

I tried asking a question here but there is no reply, so I am forcing an event  :rolleyes:

There are so many users of iPhone in the event, so the problem has not become obvious yet  :unsure:



[TOPIC: post.html]
#358

Lerg

[GLOBAL: userInfoPane.html]
Lerg
  • Contributor

  • 533 posts
  • Corona Staff

@articnetllc Scanner is translatable, it's the text param to the show function. Cancel button is shown by the OS and is localized by the OS.



[TOPIC: post.html]
#359

Lerg

[GLOBAL: userInfoPane.html]
Lerg
  • Contributor

  • 533 posts
  • Corona Staff

@CyberCatfish could you please rephrase what do you need? I am not sure if I understood you.



[TOPIC: post.html]
#360

runewinse

[GLOBAL: userInfoPane.html]
runewinse
  • Contributor

  • 485 posts
  • Corona SDK

Lerg, I have traced the problems back to the luaqrcode library:

 

https://github.com/speedata/luaqrcode

 

The problem is now fixed and things are working. It was never a problem with QRScanner in the first place.

 

Sorry for the noise.



[TOPIC: post.html]
#361

CyberCatfish

[GLOBAL: userInfoPane.html]
CyberCatfish
  • Enthusiast

  • 58 posts
  • Corona SDK

To : Lerg

Thank you, it was added to the document, so I was able to confirm it.

http://docs.spiralcodestudio.com/plugin/qrscanner/event/show/errorCode/

But now the link to this document has been disconnected from Corona's site.

Please link to the page of the plugin.

 

Also, I am doing an event in Tokyo, but the problem of the plug-in is emerging.

There are 2 problems I am checking.

1. It seems that you can not set permissions on Android 7 or later.

2. Suspected interruption failure on Android 4.

I write the details in another comment.



[TOPIC: post.html]
#362

CyberCatfish

[GLOBAL: userInfoPane.html]
CyberCatfish
  • Enthusiast

  • 58 posts
  • Corona SDK

To : Lerg
 
Problem#1. I can not set the permissions properly.
 
There was no problem with older Android, but when you install it on Android 7, you will encounter a problem that permission setting is not done.
Executing the show command of QRScnner in the application will only display a warning dialog.
Therefore, the user can not set the permission even for the first installation.
 
In this case, the user needs to change the Permission setting of the application from the Android setting.
This is a very high hurdle for beginner users.
 
## Perhaps I think the same problem that bothers runewinse.
 
 
>> Corresponding part in "build.settings"...
android = {
	useGoogleServicesJson = true,
	usesPermissions = {
		"android.permission.INTERNET",
		"android.permission.ACCESS_NETWORK_STATE",
		"android.permission.CAMERA",
		"android.permission.ACCESS_FINE_LOCATION",
		"android.permission.ACCESS_COURSE_LOCATION",
	},
	usesFeatures = {
		{ name="android.hardware.camera", required=true },
		{ name="android.hardware.location", required=true },
		{ name="android.hardware.location.gps", required=true },
	},
}

>> Warning dialog...

20180504-WarningDialog.png

 

>> App setting screen...

20180504-Settings.jpg



[TOPIC: post.html]
#363

runewinse

[GLOBAL: userInfoPane.html]
runewinse
  • Contributor

  • 485 posts
  • Corona SDK

Well, actually you can ask the user for permission from inside the app like this:

  local options = {
    appPermission = "Camera",
    urgency = "Critical",
    listener = cbFunction,
    rationaleTitle = s.str("I need camera access!"),
    rationaleDescription = s.str("The app needs camera access to be able to scan for QR codes. Please give the app access to the camera!"),
    settingsRedirectTitle = "Alert",
    settingsRedirectDescription = s.str("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 )

Is this what you're looking for?

 

cbFunction would then be the part of the code where you call the plugin scanner. 

 

I have done some trickery (part of the code shown above) so when the user taps the scan button I first check if the app has permission and if not run the code above. This is for Android. For iOS I just have to hope that the permissons are in order, because I don't know how to detect permissions in iOS and the only thing that the user will experience is that the QR scanner fails.

 

That is what I asked Lerg for. If it's possible, on some lower level that he has access to, to ask the user for permission to access the camera FROM WITHIN the plugin, so that we users (of the plugin) do not have to deal with this mess.



[TOPIC: post.html]
#364

CyberCatfish

[GLOBAL: userInfoPane.html]
CyberCatfish
  • Enthusiast

  • 58 posts
  • Corona SDK

To: runewinse  /  Thank you for a good idea.

 

There is no problem with all versions of iOS, the setting permission dialog will be displayed first.

The problem is the new version of Android.

If it gets an error at runtime, it seems good because it seems that you can authorize by running your code.

However, I feel that this is not an essential operation.

 

 

To: Lerg  /  Do you understand our problem?

 

Can not solve this problem?
 
Also I am currently reviewing the second issue.
There is a problem with certain smartphones on older Android.
It seems that there are some models that interrupt functions are not called.
It may be a complex problem and I am checking it.


[TOPIC: post.html]
#365

CyberCatfish

[GLOBAL: userInfoPane.html]
CyberCatfish
  • Enthusiast

  • 58 posts
  • Corona SDK

To: Lerg 

 

Problem#2. An event does not occur.

 

Although the camera operates with the old model, no interrupt is generated.

Sometimes interruption occurs when pause and reunion are repeated.

 

I got a model that will happen 100%.

Spec sheet: (Japanese)

  https://www.kyocera.co.jp/prdct/telecom/consumer/lineup/kyv32/spec/index.html

Model summary:

  Kyocera, KYV32, Japan, Android-4.4.4, Kernel-3.4.0, Build-101.0.1f40

Extracted from logcat:

  http://web.editey.com/12D192dXGxfDqMGZSvu94KzUMJ1kQ2NYi/20180509-logcat-filter_coronaAndSample.html

 

Is there any other way I can confirm the problem?



[TOPIC: post.html]
#366

Lerg

[GLOBAL: userInfoPane.html]
Lerg
  • Contributor

  • 533 posts
  • Corona Staff

CyberCatfish, I am pretty sure there is no problem with Android 7 in general. When a permission was denied, it's denied by the user. When you reinstall the app, the denial is still active. But for the new users who install it for the first time it should not be a problem. Try a fresh device.

Unfortunately there is nothing more I can do from within the plugin about permissions.

About Kyocera, KYV32 - in the logcat there is no error, you say it never displays the scanner view? That's really odd. Is that device generally stable? I mean it could be a buggy device on it's own. Can you record a video of whats happening? Maybe I will see something.

I am in the process of restoring the website and fixing those urls, thanks.



[TOPIC: post.html]
#367

davida6

[GLOBAL: userInfoPane.html]
davida6
  • Contributor

  • 129 posts
  • Corona SDK

@Lerg,

 

I have the plugin running (Android) but am getting unexpected results.  Could you confirm this means that:

			qrsanner.show(
				{
					listener = onCompleteScanner,
					symbols = {'code39', 'code39mod43'},
					overlays = {
						searching = {
							filename = "images/searching.png",
							baseDir = system.ResourceDirectory
						},
						mismatch = {
							filename = "images/mismatch.png",
							baseDir = system.ResourceDirectory
						},
						found = {
							filename = "images/found.png",
							baseDir = system.ResourceDirectory
						},
					}
				})		

1) including the symbols variable should limit formats to the ones identified

         problem: in my code and your sample, the plugin is returning codes from ean-8, ean-13, databar and others.

         it appears that the scanner is reading a code, then running through the entire set of formats (ignoring the symbols variable) and returning the first that is close.

 

2) is the plugin defaulting the scanned area within the non-grey portion of files in the overlays table.  In your sample code, the mask option doesnt match up with the overlays.  Can these or shouldn't these be synced?  It IS loading the 3 overlays at the proper times.  I'm trying to sync up with a narrower area closer to the top of the screen, but if I try to scan from a sheet of codes (inventory sheet) it pulls the wrong code.

 

Thanks

 

Dave



[TOPIC: post.html]
#368

Lerg

[GLOBAL: userInfoPane.html]
Lerg
  • Contributor

  • 533 posts
  • Corona Staff

@davida6, hi. I have to check the codes, so will reply a bit later.

Mask and overlays are independent. You should try to match overlay image with the masking, but it's not required.



[TOPIC: post.html]
#369

davida6

[GLOBAL: userInfoPane.html]
davida6
  • Contributor

  • 129 posts
  • Corona SDK

He @Lerg

Able to find anything?

Dave


[topic_controls]
« Page 15 of 15 13 14 15
 
[/topic_controls]

Also tagged with one or more of these keywords: release, android, ios