我正在开发Cordova的应用程序,但Zxing的条形码扫描仪在扫描产品后需要添加扫描/退出按钮和关闭按钮时自动打开和关闭扫描仪不应自动打开和关闭。我还需要检查扫描的产品是否存在于数据库中(SQL SERVER),并返回产品信息,我试图谷歌,但无济于事,请help.the以下是我在Eclipse中的代码。我需要知道我可以如何修改UI并添加自己的控件来控制我在Eclipse中开发的ZXING条形码扫描器插件,并在IIS中托管一个Web API服务,我可以访问我的Android App.Please尽快或告诉我如何我可以修改此条形码用户界面以添加我的控件。PhoneGap条码扫描仪问题
public void scan() {
Intent intentScan = new Intent(SCAN_INTENT);
intentScan.addCategory(Intent.CATEGORY_DEFAULT);
this.cordova.startActivityForResult((CordovaPlugin) this, intentScan, REQUEST_CODE);
}
我的OnStartActivity代码是这里的代码,但它看起来像你的一样。
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == REQUEST_CODE) {
if (resultCode == Activity.RESULT_OK) {
JSONObject obj = new JSONObject();
try {
obj.put(TEXT, intent.getStringExtra("SCAN_RESULT"));
obj.put(FORMAT, intent.getStringExtra("SCAN_RESULT_FORMAT"));
obj.put(CANCELLED, false);
} catch (JSONException e) {
Log.d(LOG_TAG, "This should never happen");
}
//this.success(new PluginResult(PluginResult.Status.OK, obj), this.callback);
this.callbackContext.success(obj);
} else if (resultCode == Activity.RESULT_CANCELED) {
JSONObject obj = new JSONObject();
try {
obj.put(TEXT, "");
obj.put(FORMAT, "");
obj.put(CANCELLED, true);
} catch (JSONException e) {
Log.d(LOG_TAG, "This should never happen");
}
//this.success(new PluginResult(PluginResult.Status.OK, obj), this.callback);
this.callbackContext.success(obj);
} else {
//this.error(new PluginResult(PluginResult.Status.ERROR), this.callback);
this.callbackContext.error("Unexpected error");
}
}
}
我已编辑和张贴我的代码已经存在,但它仍然不能正常工作 –
对不起,延迟的答复...所以它仍然在做同样的事情..它打开扫描仪并关闭inmediatly ...尝试使用另一个QR扫描仪...我建议你使用QR Droid – geekCode
艾特谢谢你的QR Droid工作比ZXIng更好吗? –