从Android中的扫描条形码获取产品信息 [英] Getting product information from a scanned barcode in Android

查看:341
本文介绍了从Android中的扫描条形码获取产品信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个简单的条形码扫描仪应用程序,该应用程序可以扫描条形码并显示产品信息.

I am developing a simple barcode scanner app which scans a barcode and displays the product info.

使用Zbar库,我可以扫描条形码并获取任何产品的GTIN(条形码编号).

Using Zbar library I am able to scan barcode and get the GTIN (barcode number) for any product.

如何将扫描的条形码数据转换为可以显示给用户的实际产品信息?是否有一些API或库可用于完成此任务?

How can I convert the scanned barcode data to actual product information that I can display to the user? Is there some API or library available to accomplish this?

推荐答案

假设您所指的是通用的销售点条形码格式,这些格式都带有某种商品标识符的变体,称为全球贸易识别码(GTIN) :

Assuming that you are referring to the common Point Of Sale barcode formats these all carry some variant of a product identifier referred to as a Global Trade Identification Number (GTIN):

  • UPC-A-GTIN-12
  • UPC-E-零抑制的GTIN-12 [*]
  • EAN-13-GTIN-13
  • EAN-8-GTIN-8
  • UPC-A - GTIN-12
  • UPC-E - Zero-suppressed GTIN-12 [*]
  • EAN-13 - GTIN-13
  • EAN-8 - GTIN-8

除GTIN-8外,每个其他都可以通过以"0"为前缀转换为GTIN-14. (GTIN-8是一个离散数字系统,目前尚未映射到GTIN-14数字系统的任何部分.)

Each of these except GTIN-8 can be converted into a GTIN-14 by prefixing with "0"s. (GTIN-8 is a discrete number system that is not currently mapped into any part of the GTIN-14 number system.)

之后,将使用以下答案的查找"部分:

After which the "Lookup" part of the following answer applies:

https://stackoverflow.com/a/31760872/2568535

[*]零抑制的GTIN-12可以转换为十二位格式("UPC-A"),如下所示: 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆