QR Code Scanner

Hi,

Just collecting some code from Internet and making a QR Code scanner for Fuse. It’s very basic, but it should be enough for most of QR code scanner. The iOS version is based on AVFoundation framework (require iOS 7+) and the Android version is based on Google Vision API (part of Google Play Service library) and it should work on Android 4.0+

https://github.com/zean00/fuse-qreader

Currently, it was built with Fuse 0.12.3 and tested on iphone5 iOS 8.4 and Lenovo Android 4.4. However, the android version has an issue, it will tell error while building with Fuse, but the generated project could be build and run with android studio without error message.

[aapt] /Users/sahalzain/Workspace/Fuse/fuse-qreader/build/Android/Preview/QreaderLibrary/app/src/main/bin/AndroidManifest.xml:61: error: Error: No resource found that matches the given name (at 'theme' with value '@style/Theme.AppCompat').

BUILD FAILED
/usr/local/Cellar/android-sdk/24.4.1_1/tools/ant/build.xml:649: The following error occurred while executing this line:
/usr/local/Cellar/android-sdk/24.4.1_1/tools/ant/build.xml:694: null returned: 1

I’m not sure why, since I’m very new to Android development and Fuse, any suggestion are welcome.

Please note, since I’m very new for Android, iOS, and Fuse development (I’m a javascript developer) sorry in advance if I couldn’t help if any of you have some issue or advance question.

Thanks

Sahal … you are the best :slight_smile: … but maybe you can join to Slack and there will be somebody, which can maybe help fix these issues.

Sahal, great work!

I’ve raised an issue internally to look at the android bug. I’ll post back here as soon as I have some news.

As soon as this works, I’m scanning everything :smiley:

Any progress with this one? I would like to scan everything as well.

Hi folks, sorry to say this got pushed down the list whilst we were focussing on getting various large features out the door.

I’ll have a look at this again today, hopefully I can at least get some extra info on this issue to you.

Ok so the first thing I did was to add the google play libs to the build by changing your unoproj file to this:

{
    "Packages": [
        "Fuse",
        "FuseJS",
        "Android.Google.Play.Meta"
    ],
    "Includes": [
        ".uno",
        ".ux",
        "QreaderTask.h:ObjCHeader:iOS",
        "QreaderTask.mm:ObjCSource:iOS",
        "QRCodeReader.h:ObjCHeader:iOS",
        "QRCodeReader.mm:ObjCSource:iOS",
        "QRCodeReaderDelegate.h:ObjCHeader:iOS",
        "QRCodeReaderView.h:ObjCHeader:iOS",
        "QRCodeReaderView.mm:ObjCSource:iOS",
        "QRCodeReaderViewController.h:ObjCHeader:iOS",
        "QRCodeReaderViewController.mm:ObjCSource:iOS",
        "BarcodeCaptureActivity.java:Java:Android",
        "BarcodeGraphic.java:Java:Android",
        "BarcodeGraphicTracker.java:Java:Android",
        "BarcodeTrackerFactory.java:Java:Android",
        "CameraSource.java:Java:Android",
        "CameraSourcePreview.java:Java:Android",
        "GraphicOverlay.java:Java:Android"
    ]
}

I then got new errors:

fuse-qreader/build/Android/Debug/QreaderLibrary/app/src/main/java/com/fuse/qreader/BarcodeCaptureActivity.java:32: error: package android.support.design.widget does not exist
import android.support.design.widget.Snackbar;
                                    ^

fuse-qreader/build/Android/Debug/QreaderLibrary/app/src/main/java/com/fuse/qreader/BarcodeCaptureActivity.java:134: error: cannot find symbol
                Snackbar.LENGTH_INDEFINITE)
                ^
  symbol:   variable Snackbar
  location: class BarcodeCaptureActivity

fuse-qreader/build/Android/Debug/QreaderLibrary/app/src/main/java/com/fuse/qreader/BarcodeCaptureActivity.java:133: error: cannot find symbol
        Snackbar.make(mGraphicOverlay, "Access to the camera is needed for detection",
        ^
  symbol:   variable Snackbar
  location: class BarcodeCaptureActivity

The SnackBar is a member of the support repo, but we include support v4 in every build. So this must be a later version. I’ll go see where this lives.

Ahah! it was the support:design library. This is available through Gradle so I’m going to use the preliminary gradle support in Fuse (which will be released in the next couple of hours).

I first add the requirement to the QreaderImpl class

[...]
[ForeignInclude(Language.ObjC, "QreaderTask.h", "QRCodeReaderViewController.h","QRCodeReader.h")]
[Require("Gradle.Dependency.Compile", "com.android.support:design:+")]
public class QreaderImpl
{

And then build with gradle support which at 12:25 UTC hasnt been release yet :stuck_out_tongue:

fuse build -t=android -DGRADLE -r --set:SDK.BuildToolsVersion="23.0.3" --set:SDK.CompileVersion="23" --set:SDK.TargetVersion="23" QreaderLibrary.unoproj

This builds and installs! I’m going to grab my phone and test this out

[UPDATE]

It does run and the camera intent is launched, for me it didnt do anything when pointed at a QR code though. However this a big step in the right direction. Hope this helps. I can also promise this will be a bit smoother as Gradle support becomes the default.

Be sure to read the Gradle guide linked above, this is expermental support and we would like to hear your feedback.

Hi,

Will it work with current release or should I wait the next release to be able to compile with gradle option?

We made a new release yesterday so if you have that then you are able to try it out. Be sure to check the guide though as this is a preliminary feature.

Brilliant! Will give it a tryout.

[UPDATE]

It does run and the camera intent is launched, for me it didnt do anything when pointed at a QR code though. However this a big step in the right direction. Hope this helps. I can also promise this will be a bit smoother as Gradle support becomes the default.

Be sure to read the Gradle guide linked above, this is expermental support and we would like to hear your feedback.

> Hi, I notice that sometimes the Qreader doesn’t scan any qr code and just do nothing, it seems that the problem is in the autofocus mode, currently I update the autofocuse mode to continues video (previously continues picture), it should be work faster now. But now with the latest fuse build, I encounter several problem both on Android and iOS Fuse Fuse However, I still managed to get my code working tough, it just a little inconvenience for me.

Hi, nothing new about Fuse QR Code? thanks

This thing works on iOS and Android with 0.30 build. No problems at all. The Android side can read pretty much anything from QR to barcodes. Will need to check if it’s possible to make the iOS side recognise barcodes as well.

In any case: GOOD JOB! :slight_smile:

Thanks Simo, great to hear

Simo Santavirta wrote:

This thing works on iOS and Android with 0.30 build. No problems at all. The Android side can read pretty much anything from QR to barcodes. Will need to check if it’s possible to make the iOS side recognise barcodes as well.

In any case: GOOD JOB! :slight_smile:

Hi i’m having troubles getting this to work - could you provide a working project with the latest fuse build? That would be great…

I’m very new in Fusetools, and this post my first post here, first i want to say to dev team - Great Job ^^ thx guys, really…

subj: https://github.com/zean00/fuse-qreader - this work for me, im happy )

but here was some problems with compilation, i have already installed previously sdk & ndk, but it not recognized properly…

then i start from scratch:

remove previous installtion
and then reinstall via “fuse install android” - thats help me…

Good job guys.
Good luck.

So, QR reader not compiled in 0.35, compiled, but don’t work (no recognize) in 0.34
The problem is in Android only. iOS working well

Would love to help, but this looks like a new issue, so please start a new thread.

Thankyou

dima.lisin@gmail.com wrote:

So, QR reader not compiled in 0.35, compiled, but don’t work (no recognize) in 0.34
The problem is in Android only. iOS working well

Same error in 0.37.0 (12471)

@Cristian Karmy

Just tested in 0.36.1 & 0.37.0 (current qa).

I built using uno clean QreaderLibrary.unoproj && uno build -tandroid QreaderLibrary.unoproj -r

‘Work fine for me’ but if you are still having issues please file a new issue.