- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
哪个适用于 phonegap android 的条码扫描器插件也适用于前置摄像头?
最佳答案
要使 Cordova/PhoneGap BarcodeScanner 插件正常工作,您需要比使用大多数其他插件更进一步。
我的大部分工作都是在 Eclipse 之外进行的,所以我将解释如何从终端完成这项工作,如果您需要它们,我将添加 Eclipse 注释(尽管询问。)
如果您还没有,请从 github 获取 phonegap-plugins 项目:
git clone git://github.com/phonegap/phonegap-plugins.git
(我们假设它们被克隆到:/home/mike/phonegap-plugins
)
我们还假设您的项目名为 /home/mike/CordovaProject
出于此答案的目的。
然后复制/home/mike/phonegap-plugins/Android/BarcodeScanner/2.2.0/LibraryProject
的内容进入/home/mike/BarcodeLibrary
这将包含 zxing 库项目作为可用 Activity ,检查您是否有 AndroidManifest.xml, ant.properties, assets, bin...
等里面/home/mike/BarcodeLibrary
.
我已经用 Nexus 7 对此进行了检查,插件中包含的 zxing 库代码工作正常。 (zxing 2.1 不是 2.2)
可以在 src/com/google/zxing...
处替换 zxing 库代码使用 2.2 下载的代码,但这是不必要的,需要额外的工作/测试。
您需要更新 /home/mike/BarcodeLibrary
项目使用
android update project /home/mike/BarcodeLibrary
如果您需要指定一个目标(SDK 版本),您可以获得一个列表:android list target
顺便说一下,这假设您已经安装了 android sdk。从http://developer.android.com/sdk/获取
如果出现问题,请确保您已复制 LibraryProject
的内容进入BarcodeLibrary
现在您可以更新项目以使用 BarcodeLibrary
.将这些复制到您的项目中:
phonegap-plugins/Android/BarcodeScanner/2.2.0/assets/www/barcodescanner.js
phonegap-plugins/Android/BarcodeScanner/2.2.0/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java
进入assets/www
和 src/com/phonegap/plugins/barcodescanner
分别。
现在您需要更新 project.properties
包括 BarcodeLibrary
, 编辑它以包含新行:
android.library.reference.1=../BarodeLibrary/
(如果您有更多的库要引用,您会为它们编号,以允许对编译依赖项进行排序。)
请注意,如果您想将库直接包含到您的主项目中,您可以将它复制到一个文件夹中,例如。 /home/mike/BarcodeLibrary/external/BarcodeLibrary
然后引用将是:
android.library.reference.1=external/BarodeLibrary/
由您决定,将其放在相邻的文件夹中可以方便地重复使用和单独维护。将它放在项目本身中可以简化版本控制和持续集成。
您现在需要更新您的 AndroidManifest.xml
将这些权限添加到 <manifest>
如果它们尚未包括在内:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
将这些功能添加到 <manifest>
如果它们尚未包括在内:
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.front" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
<uses-feature android:name="android.hardware.camera.flash" android:required="false"/>
在 <application>
中添加此 Activity 节点在底部。
<activity android:name="com.google.zxing.client.android.CaptureActivity"
android:screenOrientation="landscape"
android:configChanges="orientation|keyboardHidden"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:windowSoftInputMode="stateAlwaysHidden"
android:exported="false">
<intent-filter>
<action android:name="com.phonegap.plugins.barcodescanner.SCAN"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
项目的res/config.xml 需要指定条形码插件。只需将以下行添加到 plugins 节点。
<plugin name="BarcodeScanner" value="com.phonegap.plugins.barcodescanner.BarcodeScanner"></plugin>
您应该能够继续构建项目:
ant debug
或者
cordova/run
关于android - 用于 phonegap android 的 Zxing 条码扫描器插件不适用于只有前置摄像头的 nexus 7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16919823/
我有一个“设置首选项”屏幕。它有一个 ListPreference 和一个 CheckBoxPreference。当我选择 ListPreference 的一项时,我想更改应用程序的日期格式。另外,通
我试图找到创 build 置/配置窗口的示例。单击菜单项中的“选项”操作可启动设置窗口。我想弄清楚如何从主窗口打开第二个窗口。以及新窗口如何将设置信息返回主窗口。尝试使用 QDialog 或一些继承的
我在 Lnux 上有 Qt 应用程序。我想为此创建一个可执行文件/设置以便在 Windows 上分发它并且不需要安装 Qt。我通过包含所有 dll 为此创建了可执行文件但要运行它,用户需要进入文件夹。
我正在尝试创建一个有点动态的 html 类,它根据类末尾包含的数字设置宽度 %。注意:类名将始终以“gallery-item-”开头 示例:div.gallery-item-20 = 20% 宽度 我
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 6 年前。 Improve this qu
在我的应用程序中,我想记住一些变量,例如,如果用户登录过一次,那么他们将在下次重新打开应用程序时登录,或者如果他们决定禁用某些提醒,应用程序可以检查该变量是否是错误的,将不再显示该提醒。理想情况下,这
我在 Netbeans 中开发了一个应用程序,它连接到远程计算机的消息队列并发送消息。该应用程序还有其他功能。项目完成后,我清理并构建应用程序,然后 Netbeans 创建一个 jar 文件。 但我的
我创建了一个 Outlook 加载项,需要创建一个设置以使其可分发(我是新手,所以请原谅新手评论) Outlook -2010 Vs -2010 .Net 4.0 我读了一些地方,最简单的方法就是发
这个问题已经有答案了: 已关闭10 年前。 Possible Duplicate: How to make installer pack of Java swing Application Proje
这个问题肯定已经被很多人解决过很多次了,但是经过几个小时的研究,我仍然没有找到我要找的东西。 我有一个 ExportSettings.settings 文件,其中包含一堆设置( bool 值、字符串、
我想为我的项目创建一个安装程序,以便它可以安装在任何电脑上而无需安装头文件。我怎样才能做到这一点? 最佳答案 一般有两种分发程序的方法: 源代码分发(要构建的源代码)。最常见的方法是使用 GNU au
如何在这样的动态壁纸中创 build 置 Activity ? Example Picture 我只用一个简单的文本构建了设置 Activity ,但遇到了一些问题。第一个问题是我不能为此 Activ
我用 GUI 创建了一个简单的软件。它有几个源文件。我可以在我的编辑器中运行该项目。我认为它已经为 1.0 版本做好了准备。但我不知道如何为我的软件创 build 置/安装程序。 源代码是python
我的 SettingsActivity当前扩展了 Android Studio 生成的类,AppCompatPreferenceActivity扩展 PreferenceActivity . Acti
我正在使用 .NET 为 IE 开发工具栏。目前,我使用 gacutil 插入我的 .NET 程序集,并使用 regasm 注册我的 COM 程序集。 我想为项目创建一个设置 (MSI),但我似乎无法
在为设置页面创建 Activity 后,我注意到 if (mCurrentValue !== value) 中的 mCurrentValue !== value 返回警告: Identity equa
我在 Visual Studio 10 中创建了一个项目,该项目使用 Mysql 数据库和 Crystalreports 以及 它。但是我不知道如何进行自动安装 Mysql 和 Crystalrepo
我正在尝试在我的 C# 项目中使用 Sqlite 数据库,并且我在 IDE 中做得很好。我的问题是当我为我的项目制作安装包并安装它时,程序无法访问 sqlite 数据库。我也知道这是因为用户没有访问文
我有一个大型 Web 应用程序(带有 11 子系统的 ErP),我想使用 Microsoft WebPI 为它创建一个设置。 目前,我们每周向客户发送一次应用程序(用于每周更新)。 我们在此应用程序中
所以我对工资单申请的最终查询是 - 如何为薪资申请创 build 置? 我需要知道的一切- 如何将设置项目添加到我现有的解决方案 如何将解决方案中的文件添加到安装项目中,以及添加哪些文件添加和在什么文
我是一名优秀的程序员,十分优秀!