简体   繁体   English

Gluon Charm Down 条码扫描仪 - 未找到意图处理程序

[英]Gluon Charm Down Barcode Scanner - Intent handler not found

I am using Netbeans 8.1 and the gluonhq jfxplugin 2.2.0.我正在使用 Netbeans 8.1 和 gluonhq jfxplugin 2.2.0。

I am trying to read a barcode, and created a new project (the standard hello world).我正在尝试读取条形码,并创建了一个新项目(标准的 hello world)。 I changed the button handler to call a function UpdateText() (below) which in turn calls the Charm Down Scan service.我更改了按钮处理程序以调用函数 UpdateText()(如下),该函数又调用 Charm Down Scan 服务。

When I run the app, and click on the button I get the following error in the Android Device Manager:当我运行应用程序并单击按钮时,我在 Android 设备管理器中收到以下错误:

E/AndroidRuntime(3583): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.gluonhq.charm.down.android.scan.SCAN cat=[android.intent.category.DEFAULT] flg=0x4080000 }

This crash is happening on the scanservice.scan() line.此崩溃发生在 scanservice.scan() 行上。

Button click handler code:按钮单击处理程序代码:

    protected void UpdateText(Label label) {
        ScanService scanService = PlatformFactory.getPlatform().getScanService();
        StringProperty scannedString = scanService.scan();
        scannedString.addListener((obs, ov, nv) -> System.out.println("Scanned String = " + nv));
    }

I would greatly appreciate any help我将不胜感激任何帮助

You need to define the com.gluonhq.charm.down.android.scan.SCAN intent in your AndroidManifest.xml file.您需要在 AndroidManifest.xml 文件中定义com.gluonhq.charm.down.android.scan.SCAN意图。 Add the following activity definition below your main activity definition:在您的主要活动定义下方添加以下活动定义:

<activity android:name="com.gluonhq.charm.down.android.scan.zxing.CaptureActivity"
        android:screenOrientation="sensorLandscape"
        android:clearTaskOnLaunch="true"
        android:stateNotNeeded="true"
        android:windowSoftInputMode="stateAlwaysHidden">
    <intent-filter>
        <action android:name="com.gluonhq.charm.down.android.scan.SCAN"/>
        <category android:name="android.intent.category.DEFAULT"/>
    </intent-filter>
</activity>

By default, the AndroidManifest.xml file is generated for you under the hood by the plugin.默认情况下,AndroidManifest.xml 文件是由插件在后台为您生成的。 If you haven't setup a custom AndroidManifest.xml file yet, you can copy the one that the plugin generates.如果您还没有设置自定义 AndroidManifest.xml 文件,您可以复制插件生成的文件。 The default version is located in build/javafxports/tmp/android/AndroidManifest.xml .默认版本位于build/javafxports/tmp/android/AndroidManifest.xml Just copy that one to a persistent location, ie src/android .只需将那个复制到一个永久位置,即src/android Then update your build.gradle to tell the plugin that it should use the custom AndroidManifest.xml file instead of generating the default one:然后更新您的 build.gradle 以告诉插件它应该使用自定义 AndroidManifest.xml 文件而不是生成默认文件:

jfxmobile {
    android {
        manifest = 'src/android/AndroidManifest.xml'
    }
}

update: You also need to add an extra dependency to the zxing core library as it seems it isn't included automatically when depending on the charm library alone:更新:您还需要向 zxing 核心库添加额外的依赖项,因为当仅依赖于魅力库时,它似乎不会自动包含在内:

dependencies {
    androidRuntime 'com.google.zxing:core:3.2.1'
}

Furthermore, you'll have to add the CAMERA permission to your manifest as well:此外,您还必须将 CAMERA 权限添加到您的清单中:

<uses-permission android:name="android.permission.CAMERA"/>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我活动中的条形码扫描仪意图 - Barcode Scanner intent in my activity 为什么我使用PhoneGap和条形码扫描仪插件不断收到“找不到用于处理Intent的活动”? - Why do I keep getting “No activity found to handle Intent” using PhoneGap and the barcode scanner plug-in? 没有收到来自Zxing条码扫描器的Intent - Not receiving an Intent back from Zxing barcode scanner android中的条码扫描器,不是通过意图在我的应用程序中提供的,而是具有内置的条码扫描器 - Barcode scanner in android from within my app and not via intent but have an inbuilt barcode scanner 如何从&#39;com.gluonhq.impl.charm.down.plugins.android。*&#39;导入Gluon Mobile的Custom PicturesService - How Do I Import From 'com.gluonhq.impl.charm.down.plugins.android.*' For Custom PicturesService for Gluon Mobile zxing条形码 - 如何将扫描仪(意图)与其他布局嵌入 - zxing barcode - how to embed the scanner(intent) with other layouts ZXing条码扫描仪意图:设置DecodeHintType.ASSUME_GS1 - ZXing Barcode Scanner Intent: set DecodeHintType.ASSUME_GS1 如何通过 Intent 向 ZXing Barcode Scanner 提供资源图像 - How to supply resource image to ZXing Barcode Scanner via Intent Phonegap-条形码扫描仪插件-在真实设备上找不到类 - Phonegap - barcode scanner plugin - Class not found on real device 未找到Android Google Play Service Vision条形码扫描程序库 - Android Google Play Service Vision Barcode scanner Library not found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM