我已经完成了一些研究(Stack Overflow和网络版),并且看到还有一些关于Google Goggles的问题以及在Android上使用它的可能性;通过意图。我意识到它没有得到官方支持,我们仍在等待Google打开API或为我们提供在我们的应用程序中轻松使用它的功能。
那就是说 - 如果有人可以提供帮助,我仍然希望得到以下答案/澄清?
引用此问题:zxing intent "google goggles" doesn't recognize barcodes
Google Goggles确实解码了条形码,但确实如此...所以在我的应用中,我通过IntentIntegrator调用最新版本的Google Goggles应用:
https://code.google.com/p/zxing/wiki/ScanningViaIntent https://code.google.com/p/zxing/source/browse/trunk/android-integration/src/com/google/zxing/integration/android/IntentIntegrator.java
通过IntentIntegrator进行的此调用成功地以扫描模式(各种类型)打开Google Goggles,但是UI上没有显示“捕获”按钮,它隐藏/不可用...因此无法拍摄/捕获任何图像,以查看带有结果的回调是否有效。
所以我的想法是:
以下是我打电话打开Google Goggles的代码示例。还包括另一种做同样事情的方法,但注释掉了以供参考。
// Try and open Google Goggles for scanning
try{
IntentIntegrator integrator = new IntentIntegrator(getSupportActivity());
integrator.initiateScan(IntentIntegrator.TARGET_ALL_KNOWN);
//Intent intent = new Intent("com.google.zxing.client.android.SCAN");
//intent.setPackage("com.google.android.apps.unveil");
//startActivity(intent);
}catch(Exception e){
Log.e(ScanFragment.class.getName(), "onViewCreated > Error creating scan Intent to Google Goggles: " + e.getMessage());
}
//>
任何有关了解更多信息的帮助都将不胜感激;感谢。
// WildStyle
答案 0 :(得分:3)
是的,我实际上不确定Goggles是否支持此Intent
。它不在默认情况下定位的应用列表中。因此,如果您使用IntentIntegrator
,我认为您不打开Goggles;您正在打开其中一个条码扫描器应用程序。他们没有捕获按钮,您只需将条形码带入视图。
如果它确实打开了Goggles,可能之前已将其设置为此Intent
的默认值,并且优先级正确。尝试在“设置”中清除应用程序处理程序关联。