用网页的Andr​​oid吧code扫描仪整合 [英] Android barcode scanner integration with web page

查看:137
本文介绍了用网页的Andr​​oid吧code扫描仪整合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直都凌晨集成的机器人吧code扫描仪应用到网页研究,但还没有发现正是我需要知道的。我想有一个网页,用户可以在文本字段中使用的机器人吧code扫描仪填补。因此,用户会在网页上,并要么单击文本字段中,或单击旁边的文本字段,将开始在Android吧code扫描仪的按钮。然后,他们将扫描吧code和文本字段会被填写。

I have been researching all morning about integrating an android barcode scanner app into a web page, but haven't found exactly what I need to know. I want to have a web page that the user can fill in text fields by using an android barcode scanner. So the user would be on a web page and would either click inside the text field or click a button next to the text field that would start the android barcode scanner. They would then scan the barcode and the text field would be filled in.

我已经找到了如何做到这一点,然后去到不同的网页的解决方案,但重要的是,用户停留在同一页面上。我已经看到了zxing项目,认为也许能使用,但我不知道它是否允许该页面以保持不变。

I have found solutions on how to do this and then go to a different page, but it is important that the user stays on the same page. I have seen the zxing project and thought that might be able to be used, but I'm not sure if it allows for the page to stay the same.

我是pretty的肯定,这是可能的,并知道如果任何人可以给我他们会如何做一个高度概括。我想这可能是能够与被提交按钮上点击一个Ajax请求完成。 AJAX请求将被发送到我的服务器时,服务器会送东西给Android设备将启动扫描仪和返回这反过来又被送回了Ajax响应的数据。有没有什么办法,虽然削减了服务器,只是有开始吧code扫描仪的Andr​​oid浏览器?感谢您的时间和我的AP preciate上的任何讨论。

I'm pretty sure this is possible and is wondering if any one could give me a high level overview on how they would do it. I was thinking it might be able to be done with an ajax request that gets submitted on a button click. The ajax request would get sent to my server, the server would send something to the android device that would start the scanner and return the data which in turn gets sent back in the ajax response. Is there any way to cut out the server though and just have the android browser starting the barcode scanner? Thank you for your time and I appreciate any discussion on it.

推荐答案

使用的JavaScript界面​​和使用loadURL(JavaScript的...),你可以与你的Andr​​oid网页通信

Using a javascript interface and loadurl(javascript...) you can communicate with your webpage from Android

public void loadScript(String script){      
    webview.loadUrl("javascript:(function() { " + script + "})()");             
}

private class JavaScriptInterface {     
    public void startQRScan() {
        ...
    }
}

有很多关于谷歌的例子。

There are plenty of examples on google.

这篇关于用网页的Andr​​oid吧code扫描仪整合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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