嵌入式 ZXing - 我缺少什么?

发布于 2024-09-05 00:00:27 字数 400 浏览 14 评论 0原文

抱歉,如果之前已经回答过这个问题,但我正在尝试制作一个应用程序,其中包含在 Android 上扫描条形码的功能。我正在考虑使用 ZXing 作为库,但是,我想将扫描仪嵌入到我的应用程序中,以便用户不必安装 ZXing 条形码扫描仪即可使用我的应用程序。从ZXing的描述来看,听起来这是有可能的。

我已经构建了 ZXing,将其链接到我在 Eclipse 中的项目,然后创建了一个新的阅读器实例。然而,当谈到启动条形码阅读器和实现回调时,我迷失了。 IMO,这是此处的文档变得模糊的时候。

如果有人能解释如何正确使用 ZXing,那将会有很大帮助。

干杯!

Sorry if this has been answered before, but I am trying to make an application that will include the ability to scan barcodes on Android. I'm looking at using ZXing as the library, however, I want to embed the scanner in my application so that the user doesn't have to have the ZXing barcode scanner installed to use my application. From the description of ZXing, it sounds like this is possible.

I've gotten as far as building ZXing, linking it into my project in Eclipse, then creating a new reader instance. However, I'm lost when it comes to starting the barcode reader and implementing the callbacks. IMO, this is when the documentation here gets hazy.

If someone could explain how to use ZXing properly, that would be of great help.

Cheers!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

玉环 2024-09-12 00:00:27

就我个人而言,我喜欢使用多个应用程序作为插件。这样,用户就不必在手机上多次使用相同的代码(毕竟存储空间有限),而且 - 更重要的是 - 如果 ZXing 改进了条形码扫描仪(他们经常这样做),用户将自动拥有最新、最好的版本,而无需再次集成和修改它以满足您的需求。

您可以简单地检测该应用程序是否存在,如果不存在则提示用户安装它。您可以简单地将 pname:Uri 链接到 zxing 应用程序,这将自动启动市场并允许用户安装该应用程序。

也就是说,如果你真的想嵌入代码,一种方法是下载相关源文件,重命名包名称和意图名称,这样它们就不会与ZXing的代码冲突,然后只需调用意图来扫描条形码(就像您使用条形码扫描仪作为插件时通常所做的那样)。如果您这样做,请务必在您的文档中感谢 ZXing 的工作,并确保他们的服务条款允许使用和修改其源代码。

Personally, I'm a fan of using multiple apps as plug-ins. That way, the user doesn't have to have the same code on the phone multiple times (storage is limited, after all), and - more importantly - if ZXing improves the barcode scanner (which they do often), the user will automatically have the latest and greatest version without you having to integrate and modify it again to fit your needs.

You can simply detect for the presence of the app, and prompt the user to install it if it doesn't exist. You can simply link to the pname: Uri to the zxing app, which will automatically fire up the market and allow the user to install the app.

That said, if you really want to embed the code, one way would be to download the relevant source files, rename the package names and intent names so they don't clash with ZXing's code, and then simply call the intent to scan the barcode (like you would normally do when you use the barcode scanner as a plug-in). If you do that, be sure to credit ZXing for their work in your documentation, and make sure their terms of service allow for using and modifying their source code.

混吃等死 2024-09-12 00:00:27

条码扫描仪的完整源代码位于 android/ 目录。这大概是你能要求的最好的解释了。

如果您出于自己的目的用新代码重写它,我认为这更取决于您,而不是项目来解释。

您可能会在项目讨论组中获得更多有用的信息。

Complete source code to Barcode Scanner is in the android/ directory. That is about the best explanation you could ask for.

If you're rewriting it with new code for your own purpose, I think that's more up to you than for the project to explain.

You might get more useful information at the project discussion group.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文