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+
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.
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
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.
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.
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 FuseFuse However, I still managed to get my code working tough, it just a little inconvenience for me.
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.
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!
Hi i’m having troubles getting this to work - could you provide a working project with the latest fuse build? That would be great…