Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
541 views
in Technique[技术] by (71.8m points)

使用angular js+ionic +cordova开发手机APP扫描二维码时报错怎么解决?

controller代码:

.controller('saomaController',function  ($scope,$cordovaBarcodeScanner) {
 $scope.scanStart = function () {
     $cordovaBarcodeScanner.scan()
      .then(function(barcodeData) {
        $scope.barcodeData = barcodeData.text;
        // Success! Barcode data is here 扫描数据:barcodeData.text
      }, function(error) {
        alert("我出现ERROR了:" + error);
        // An error occurred
      }); }})

html代码:

 <ion-view title="扫码签到">
 <ion-content>
<div class="card">
  <div class="item">
    <button class="button button-block button-positive" ng-click="scanStart()">
      <i class="icon ion-qr-scanner"></i>
      Scan Now
    </button>
  </div>
</div>
<div class="card">
  <div class="item item-divider">Scan Results</div>
  <div class="item item-text-wrap">
    {{barcodeData}}
  </div>

</div>
<!--<img src="img/scan.png" width="250" height="180" ng-click="openScanCamara()">-->
</ion-content>
</ion-view>

AndroidManifest.xml部分代码:

  <activity android:clearTaskOnLaunch="true" android:configChanges="orientation|keyboardHidden|screenSize"
 android:exported="false" 
 android:name="com.google.zxing.client.android.CaptureActivity" 
 android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
 android:windowSoftInputMode="stateAlwaysHidden">
  <intent-filter>
    <action android:name="com.google.zxing.client.android.SCAN" />
    <category android:name="android.intent.category.DEFAULT" />
  </intent-filter>
  </activity>
   <uses-permission android:name="android.permission.CAMERA" />
   <uses-feature android:name="android.hardware.camera" android:required="true" />

我使用真机调试时提示错误如下:

 Alert: Scanning failed:No Activity found to handle Intent{ act=com.google.zxing.client.android.SCAN cat=[android.intent.category.DEFAULT]pkg}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...