B4A Library QRCodeReaderView - QR Code Scanner that is also 100% embedded in B4A (new B4A lib files in post #8)

huffy

Member
Licensed User
Longtime User
Hi Johan,

Great library thanks - it works a treat for the project I'm working on! Donation on its way..

One question, is it possible to use this in landscape orientation?

Thanks,
Mike
 

Mahares

Expert
Licensed User
Longtime User
One question, is it possible to use this in landscape orientation?
Yes. It works for me.
Change the line in the IDE to read landscape like seen below instead of portrait. You may also want to create a new layout 480x320 or modify your existing layout to adjust the placement and display all views. You can also switch from one orientation to the other.
B4X:
#SupportedOrientations: landscape
 

huffy

Member
Licensed User
Longtime User
Thanks Mahares, I tried that but the camera is rotated 90 degrees when in landscape - see attached screenshot of a example app. Any ideas?

Thanks

 

Mahares

Expert
Licensed User
Longtime User
Here is attached the example with 2 layouts I modified and ran, and it scans QR codes very well for me on my devices. Please try it. I hope it suits your device.
 

Attachments

  • huffyQRcodeViewer032116.zip
    9.1 KB · Views: 568

huffy

Member
Licensed User
Longtime User
I appreciate your help but the camera is still rotated 90 degrees using your example.

I guess it must be the device I'm using (Samsung Galaxy Tab 3 Lite 7.0")

Thanks again
 

Johan Schoeman

Expert
Licensed User
Longtime User
Hi Johan,

Great library thanks - it works a treat for the project I'm working on! Donation on its way..

One question, is it possible to use this in landscape orientation?

Thanks,
Mike
Thanks Mike! I hope the "hack" that I have sent you will do the trick.
 

so27

Active Member
Licensed User
Longtime User
Can I, for example, open an image with QR Code and then read the QR code? So completely without camera.

I try the scanned QR save. But Image remains white. Does anyone know why?
B4X:
    Dim cnv As Canvas
    cnv.Initialize(qrcrv)
    Dim Out As OutputStream
    Out = File.OpenOutput(File.DirRootExternal, "qrcode.png", False)
    cnv.Bitmap.WriteToStream(Out, 100, "PNG")
    Out.Close
 
Last edited:

Johan Schoeman

Expert
Licensed User
Longtime User
Can I, for example, open an image with QR Code and then read the QR code? So completely without camera.

The library does not make provision for that option at present. There is a library somewhere in the forum that will decode the barcode (1D and 2D) from an image


I try the scanned QR save. But Image remains white. Does anyone know why?

qrcrv is not a bitmap
 

so27

Active Member
Licensed User
Longtime User
The library does not make provision for that option at present. There is a library somewhere in the forum that will decode the barcode (1D and 2D) from an image




qrcrv is not a bitmap

Okay, thank you.
 

joilts

Member
Licensed User
Longtime User
Great Lib. Works perfect in many phones. Only one point to see if I can find help: On Samsung S6 Edge, the image get "out of focus" sometimes. Is there a way to request the camera to focus again?

Thanks,
 

SlashIT

Member
Licensed User
Longtime User
question: Is it possible to retrieve the x / y position of the upper left corner of the qrcode?
thanks
 

Johan Schoeman

Expert
Licensed User
Longtime User
question: Is it possible to retrieve the x / y position of the upper left corner of the qrcode?
thanks
I guess it is possible but I have no intention to dig through the ZXING core code to see if we can somehow find a way to bring back the left top x/y position. If you can find it then let me know and I will try to add code to bring it back
 

Johan Schoeman

Expert
Licensed User
Longtime User
Great Lib. Works perfect in many phones. Only one point to see if I can find help: On Samsung S6 Edge, the image get "out of focus" sometimes. Is there a way to request the camera to focus again?

Thanks,
Will see if I can somehow force an auto focus. The original Github code seems OK and should actually do it automatically
 

Alisson

Active Member
Licensed User
Johan, good morning.
I'm using your library to a similar authentication with whatsapp:


https://web.whatsapp.com/


I press the start button, but does not show the camera image to read the QRcode.
The camera captures the image is black.
When I press the stop button or the back of the phone button, the application hangs and the following error appears:



Can you help me please?

Thnaks very much!
 

Johan Schoeman

Expert
Licensed User
Longtime User
This is the B4A manifest file of the project that I have posted:
B4X:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
'AddManifestText(
'<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="14"/>
'<supports-screens android:largeScreens="true"
'    android:normalScreens="true"
'    android:smallScreens="true"
'    android:anyDensity="true"/>)
'SetApplicationAttribute(android:icon, "@drawable/icon")
'SetApplicationAttribute(android:label, "$LABEL$")
'SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")
'End of default text.


'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="17"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
AddManifestText(<uses-feature android:name="android.hardware.telephony" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.camera" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.camera.flash" android:required="false" />)
'AddPermission("android.permission.ACCESS_COARSE_LOCATION")
AddPermission("android.permission.INTERNET")
AddPermission("android.permission.ACCESS_FINE_LOCATION")
AddPermission("android.permission.WAKE_LOCK")
AddPermission("android.permission.DEVICE_POWER")
'AddPermission("android.permission.ACCESS_COARSE_UPDATES")
AddPermission("android.permission.READ_PHONE_STATE")
AddPermission("android.permission.VIBRATE")
AddPermission("android.permission.CAMERA")
AddPermission("android.permission.FLASHLIGHT")
AddPermission("android.hardware.camera")
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")

Update your B4A project's manifest file accordingly and then it will work (have tested your sample project that you have sent me and when the manifest is updated it is all OK).
 

Johan Schoeman

Expert
Licensed User
Longtime User
Hi Johan, great job. I've same problem, can you also help me? Thanks
@huffy has donated for the "hack". So best you ask him if he is OK with me publishing it on the forum for everyone else to use.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…