Barcode scanning on iOS



  • I've been using the "BarCode Scanner" (zxing) app successfully via Intents on Android for years, and now we're looking for a way to scan barcodes in our Qt/QML (Qt Quick Controls 1) on iOS as well.

    I did look at this project, https://github.com/ftylitak/qzxing/, but it seems to have some drawbacks:

    • QZXingLive didn't work for me when testing with Qt 5.7 and 5.8 (no camera view appears) on Android, works on Windows though (I haven't tried yet on iOS though...)
    • looks like it uses quite old zxing libs?

    Please correct me if I'm wrong. What would be your advice on how to enable barcode scanning in your Qt/QML app for iOS? We would just need to be able to open the camera, scan a barcode (typically simple 1d) and get back the result to do our search in our app-internal database.

    We've done some simple Qt to Objective-C integration (like including Firebase API) before, maybe using something like this would be preferable?https://developer.apple.com/library/prerelease/content/samplecode/AVCamBarcode/Introduction/Intro.html

    Thanks,
    TomasL



  • You shoud try to edit Manifest.xml file and set targetSdk to API 22 .



  • @luca , thanks.

    Now tested QZXingLive example on Android using Qt 5.7.0 and 5.8.0. Changed target sdk from api 23 to 22, but still get this error when starting the app:

    Starting remote process.E Zygote  : v2
    I SELinux : Function: selinux_compare_spd_ram, index[1], SPD-policy is existed. and_ver=SEPF_SECMOBILE_6.0.1 ver=11
    W SELinux : Function: selinux_compare_spd_ram, index[1], priority [2], priority version is VE=SEPF_SECMOBILE_6.0.1_0032
    E Zygote  : accessInfo : 0
    I libpersona: KNOX_SDCARD checking this for 10382
    I libpersona: KNOX_SDCARD not a persona
    W SELinux : SELinux: seapp_context_lookup: seinfo=default, level=s0:c512,c768, pkgname=org.qtproject.example
    I art     : Late-enabling -Xcheck:jni
    D TimaKeyStoreProvider: TimaSignature is unavailable
    D ActivityThread: Added TimaKeyStore provider
    E File    : fail readDirectory() errno=2
    E Qt      : Can't create main activity
    E Qt      : java.io.FileNotFoundException: --Added-by-androiddeployqt--/qml/QtQuick/Controls.2/designer/BusyIndicatorSpecifics.qml
    E Qt      : 	at android.content.res.AssetManager.openAsset(Native Method)
    E Qt      : 	at android.content.res.AssetManager.open(AssetManager.java:363)
    E Qt      : 	at android.content.res.AssetManager.open(AssetManager.java:337)
    E Qt      : 	at org.qtproject.qt5.android.bindings.QtLoader.copyAsset(QtLoader.java:358)
    E Qt      : 	at org.qtproject.qt5.android.bindings.QtLoader.extractBundledPluginsAndImports(QtLoader.java:467)
    E Qt      : 	at org.qtproject.qt5.android.bindings.QtLoader.startApp(QtLoader.java:546)
    E Qt      : 	at org.qtproject.qt5.android.bindings.QtActivityLoader.onCreate(QtActivityLoader.java:181)
    E Qt      : 	at org.qtproject.qt5.android.bindings.QtActivity.onCreate(QtActivity.java:269)
    E Qt      : 	at android.app.Activity.performCreate(Activity.java:6876)
    E Qt      : 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1135)
    E Qt      : 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3206)
    E Qt      : 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
    E Qt      : 	at android.app.ActivityThread.access$1100(ActivityThread.java:221)
    E Qt      : 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
    E Qt      : 	at android.os.Handler.dispatchMessage(Handler.java:102)
    E Qt      : 	at android.os.Looper.loop(Looper.java:158)
    E Qt      : 	at android.app.ActivityThread.main(ActivityThread.java:7225)
    E Qt      : 	at java.lang.reflect.Method.invoke(Native Method)
    E Qt      : 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
    E Qt      : 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
    D ViewRootImpl: #1 mView = com.android.internal.policy.PhoneWindow$DecorView{18e33cc I.E...... R.....ID 0,0-0,0}
    D SecWifiDisplayUtil: Metadata value : none
    D OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
    I Adreno  : QUALCOMM build                   : d842ad3, Ia10634f51b
    I Adreno  : Build Date                       : 01/04/16
    I Adreno  : OpenGL ES Shader Compiler Version: XE031.06.00.05
    I Adreno  : Local Branch                     : mybranch17578993
    I Adreno  : Remote Branch                    : quic/LA.BF.2.1.2_rb1.7
    I Adreno  : Remote Branch                    : NONE
    I Adreno  : Reconstruct Branch               : NOTHING
    D libEGL  : eglInitialize EGLDisplay = 0xb2a907c4
    I OpenGLRenderer: Initialized EGL, version 1.4
    D ViewRootImpl: MSG_RESIZED_REPORT: ci=Rect(0, 96 - 0, 0) vi=Rect(0, 96 - 0, 0) or=1
    W DisplayListCanvas: DisplayListCanvas is started on unbinded RenderNode (without mOwningView)
    D libGLESv1: DTS_GLAPI : DTS is not allowed for Package : org.qtproject.example
    I Timeline: Timeline: Activity_idle id: android.os.BinderProxy@4023417 time:343061117
    I Timeline: Timeline: Activity_idle id: android.os.BinderProxy@4023417 time:343064851
    


  • I just tried on my Linux PC with Qt 5.8 for Android and QZXingLive build and run without problem.
    Try starting with a clean QZXing installation .


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.