2013-06-25 31 views
1

我正在嘗試開發一個針對iOS,Android,windows等不同平臺的web應用程序。對於這個即時通訊使用HTML5,CSS3和jQuery的手機。我已經搜索了一個可用於phonegap的代碼,但是當我嘗試在android上不工作時。你能幫我麼。使用phonegap和html5和jquery的web應用程序的條碼掃描器

+0

https://github.com/wildabeast/BarcodeDemo這個我發現,但不工作時,我試過apk使用phonegap –

回答

1

好吧......既然你不是說具體是什麼是不工作...我只是通過一般步驟來運行...

步驟1 ....使用此https://github.com/phonegap/phonegap-plugins/tree/master/Android/BarcodeScanner

第2步....按照自述文件上的說明進行操作。

第3步....如果你想實際測試掃描儀,以確保它的工作。在index.html中的JavaScript,然後再<button id="scan" style="padding: 10px;">Scan!</button>

(或任何地方真的在那裏它被包括在index.html的)放:您可以創建一個按鈕開始掃描...

在index.html的某處放:

<script type="text/javascript"> 
    app.initialize(); 
    function init(){ 
     $("#scan").click(function(){ 
      console.log("I am now scanning"); 
      window.plugins.barcodeScanner.scan(function(result){ 
       alert("We got a barcode\n" + 
       "Result: " + result.text + "\n" + 
       "Format: " + result.format + "\n" + 
       "Cancelled: " + result.cancelled); 
      }, function(error){ 
       alert("Scanning failed: " + error); 
      }); 
     }); 
    } 
</script> 

另外注意,我使用jQuery做$("#scan").click(...

繼自述文件中的步驟,我能得到它的工作的時候......所以,如果它仍然無法正常工作..澄清它

相關問題