Android - 条码扫描,选项?泽兴?

发布于 2024-08-28 10:31:35 字数 785 浏览 9 评论 0原文

我想创建一个 Android 应用程序,它能够扫描条形码,获取条形码中包含的信息,然后能够以某种方式使用该信息。

我不知道如何创建条形码扫描仪,所以我去谷歌搜索,似乎 Zxing 是在应用程序中实现条形码扫描仪最常用的方法。

一些链接:


http://code.google.com/p/zxing/

http://awalkingcity.com/blog/2008 /08/25/qr-codes-made-easy-in-android/

使用 ZXing 创建 Android 条形码扫描应用程序


然而,我在 zxing 上找到的示例涉及必须提示用户去市场并安装 zxing 条形码扫描仪,以便我的应用程序可以在需要时调用条形码扫描仪,然后条形码扫描仪会将信息返回到我的应用程序。

虽然这对我来说是一个很好的起点,但我想知道是否有其他选项可以让我在自己的应用程序中嵌入条形码扫描仪,而不必提示用户下载辅助应用程序?

I want to create an application for Android that will be able to scan barcodes, get the information contained within the barcode and then be able to use that information in some way.

I have no idea how to create a barcode scanner so I went Googling and it seems Zxing is the most commonly used way to implement a barcode scanner in an app.

Some Links:


http://code.google.com/p/zxing/

http://awalkingcity.com/blog/2008/08/25/qr-codes-made-easy-in-android/

Using ZXing to create an android barcode scanning app


However the samples I found on zxing involved having to prompt the user to go to the market and install the zxing barcode scanner so that my app can then call the barcode scanner when its needed and the barcode scanner will then return the info to my app.

While this would be a good starting point for me I was wondering is there any other options that would allow me to have a barcode scanner embedded in my own application without having to prompt the user to download a secondary application?

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

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

发布评论

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

评论(7

无力看清 2024-09-04 10:31:35

开发商在这里。我认为您最终只想通过 Intent 进行集成。您可以免费获得改进、错误修复和特定于平台的解决方法。代码也少得多。但我知道您正在寻求替代方案。

您可能想删除 Barcode Scanner(其源代码位于项目中的 android/ 中)并删除您不需要的所有内容。这意味着只保留 com.google.zxing.client.androidcom.google.zxing.client.android.camera 软件包。核心解码位于 DecodeThread 中,但这些包中的其他代码实现了小的回调舞蹈,该回调舞蹈执行连续扫描并获取通常的扫描 UI。

如果您嵌入代码,则需要遵守 Apache 许可证的条款。

Developer here. I think you're going to want to just integrate via Intent in the end. You get the improvements, bug fixes, and platform-specific workarounds for free. It's much less code too. But I understand you're asking for an alternative.

You probably want to strip down Barcode Scanner (whose source is in android/ in the project) and strip out everything you don't need. That means leave only about the com.google.zxing.client.android and com.google.zxing.client.android.camera packages. The core decoding is in DecodeThread, but the other code in these packages implements the little callback dance that does the continuous scanning and gets the usual scanning UI.

If you embed the code you need to follow the terms of the Apache License.

夜深人未静 2024-09-04 10:31:35

下载并通过添加您自己的代码来扩展 Zxing“条形码扫描仪”应用程序。它遵循 Apache 2.0 许可证。

Download and extend the Zxing "Barcode Scanner" app by adding your own code. It's under an Apache 2.0 License.

喜爱皱眉﹌ 2024-09-04 10:31:35

Google Mobile Vision 已弃用并被 ML Kit 取代。 https://developers.google.com/ml-kit/vision/barcode-scanning
它在 Android 和 iOS 上提供 SDK,并利用最新的 Google 技术进行积极改进。 对于android,它提供了可以捆绑模型的sdks,如果您想节省应用程序的大小,还提供可以自动从Google play服务获取模型的SDK。

The Google Mobile Vision is deprecated and replaced with ML Kit. https://developers.google.com/ml-kit/vision/barcode-scanning
It provides sdks on both android and iOS and is getting actively improved with the latest google technology. For android, it provides sdks that can bundle the model and also provides SDK that can fetch model from Google play service automatically if you want to save your app's size.

尹雨沫 2024-09-04 10:31:35

查看包含条形码跟踪的新 Google Play Services 7.8 API:https://developers.google.com /vision/条形码-概述

Check out the new Google Play Services 7.8 API that includes Barcode tracking: https://developers.google.com/vision/barcodes-overview

半步萧音过轻尘 2024-09-04 10:31:35

我建议您通过意图使用 Zxing 并重定向到 Android Market 页面 ("market://details?id=com.google.zxing.client.android")(如果该页面不存在)(捕获 <代码>ActivityNotFoundException)。意图对于像这样的应用程序间通信非常有用。

I'd suggest you use Zxing through intents and redirect to Android Market page ("market://details?id=com.google.zxing.client.android") if it's not there (catching ActivityNotFoundException). Intents are great for inter-app communications like this.

野却迷人 2024-09-04 10:31:35

我建议使用谷歌条形码扫描。它反应非常灵敏。它被称为谷歌移动视觉。

条码扫描仪 API 可实时检测任何环境下的条码
方向。您还可以检测和解析多个条形码
同时使用不同的格式。

https://developers.google.com/vision/

https://codelabs.developers.google.com/codelabs/bar-codes/#0

I recommend to use google barcode scan. It is pretty responsive. It is called Google Mobile Vision.

The Barcode Scanner API detects barcodes in real time in any
orientation. You can also detect and parse several barcodes in
different formats at the same time.

https://developers.google.com/vision/

https://codelabs.developers.google.com/codelabs/bar-codes/#0

可可 2024-09-04 10:31:35

我有这样的工作:

repositories { mavenCentral()
    maven { url "https://raw.github.com/embarkmobile/zxing-android-minimal/mvn-repo/maven-repository/" }
}

compile 'com.google.zxing:core:3.2.1'
compile 'com.embarkmobile:zxing-android-minimal:2.0.0@aar'
compile 'com.embarkmobile:zxing-android-integration:2.0.0@aar'

我建议使用 IntentIntegrator

IntentIntegrator integrator = new IntentIntegrator(getActivity()); 
integrator.forSupportFragment(this).initiateScan();

请求代码返回不需要

IntentIntegrator.REQUEST_CODE

安装单独的扫描仪

I have it working with this:

repositories { mavenCentral()
    maven { url "https://raw.github.com/embarkmobile/zxing-android-minimal/mvn-repo/maven-repository/" }
}

compile 'com.google.zxing:core:3.2.1'
compile 'com.embarkmobile:zxing-android-minimal:2.0.0@aar'
compile 'com.embarkmobile:zxing-android-integration:2.0.0@aar'

I recommend using the IntentIntegrator

IntentIntegrator integrator = new IntentIntegrator(getActivity()); 
integrator.forSupportFragment(this).initiateScan();

The requestCode comes back with

IntentIntegrator.REQUEST_CODE

No need to install a separate scanner

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