我创建了一个搜索应用程序,我想添加一个条形码扫描仪,因此搜索数据可以由代码提供,我读到有一个针对此“zxing”的开放库。它总是为我们提供创建一个意图,因此它将管理未安装条形码扫描仪的情况,有谁知道它是否可以与其他扫描仪(例如 QR droid)一起使用?
我认为用户不想更改他/她喜欢的扫描仪应用程序。 zxings 意图与其他应用程序配合得很好吗?
I created a search app and I want to add a barcodescanner, so the search data can be provided by the code, I've read that there is an open library for this "zxing".It always offer us to create an intent so it will manage the situation where barcodescanner is not installed, does anyone knows if it works with other scanners like QR droid for exmple?
I think that a user don't want to change the scanner app that he/she prefers.do zxings intents work well with other apps?
发布评论
评论(5)
不,这确实没有意义。如果未安装,ZXing 无法向您指出其他内容。您的应用程序可以尝试确定是否安装了另一个扫描仪并使用它。或者您可以将 ZXing 的核心(而不是应用程序)与您自己的 UI 捆绑在一起。
No. That doesn't really make sense. ZXing can't point you at something else if it's not installed. Your app could try to figure out if another scanner is installed and use that. Or you could bundle the core of ZXing (not the app) with your own UI.
QR Droid 确实支持 Zxing 的意图,
除了它自己的意图
( http://qrdroid. com/android-developers/#2 )
如果您的应用使用此意图,用户将能够使用他拥有的 Zxing 或 QR Droid。
如果他两者都有,他会收到提示以选择要选择的内容。当用户没有任何一个时,请确保抓住这种情况。
QR Droid does support Zxing's intent
Besides its own
( http://qrdroid.com/android-developers/#2 )
If your app uses this intent, the user will be able to use either Zxing or QR Droid, the one he has.
If he has both, he'll get a prompt to choose what to choose. Just be sure to catch the case when the user doesn't have either one.
实际上,有多种方法可以使用 ZXing 库。有目的地使用它的方法之一是:
这段代码允许您调用扫描仪,如果您碰巧安装了另一个也使用 zxing 库的扫描仪应用程序,Android 将为您提供选择哪个扫描仪的可能性想要使用(可以永久选择该选项)。这显然是因为设备中有可用的同名意图过滤器,因此用户可以选择。
为了能够以这种方式使用 ZXing 库,请查看此网站,该网站很好地解释了如何将 ZXing 集成到您的应用程序中:http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/
Actually there are several ways to use the ZXing library. One of the ways of using it with intents is:
That piece of code allows you to call the scanner and, if you happen to have another scanner app installed that also uses the zxing library, Android will offer you the possibility to choose which scanner you desire to use (with the possibility of selecting that option permanently). This is obviously because there are intent filters with the same name available in the device, so the user may choose.
To be able to use the ZXing library in this way check this site which explains very well how to integrate ZXing to your app: http://damianflannery.wordpress.com/2011/06/13/integrate-zxing-barcode-scanner-into-your-android-app-natively-using-eclipse/
此处查看我的答案。你可以使用意图来做到这一点。如果 Zxing 应用程序未安装,您会遇到异常,因此捕获该异常后,您可以重定向到 android market 来安装该应用程序
Go through my answer here. You can just do it using an intent. And if Zxing app is not installed, you get an exception, so catching that, you can redirect to android market to install that app
是的,我相当肯定其他 QR 阅读器是 zxing 意图的意图接收者。我知道谷歌护目镜可以。测试起来相当容易。
Yes, I am fairly positive other QR readers are intent receivers for the zxing intent. I know Google goggles does. It would be fairly easy to test.