2016-06-24 114 views
1

我有一個您想要掃描該卡的項目。爲了這個任務,我使用庫card.io。最近我更新了庫到最新版本(5.4.0)現在,而不是掃描卡更改爲手動輸入。我做錯了什麼?所有設置均根據說明進行。使用card.io掃描卡

AndroidManifest

<uses-sdk 
      android:minSdkVersion="15" 
      android:targetSdkVersion="19" /> 

     <uses-permission android:name="android.permission.INTERNET" /> 
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> 
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 
     <uses-permission android:name="android.permission.CAMERA" /> 
     <uses-permission android:name="android.permission.VIBRATE" /> 
     <uses-permission android:name="android.permission.NFC" /> 
     <uses-permission android:name="com.google.android.gallery3d.permission.GALLERY_PROVIDER" /> 
     <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> 

    <activity android:name="io.card.payment.CardIOActivity" android:configChanges="keyboardHidden|orientation" /> 
      <activity android:name="io.card.payment.DataEntryActivity" /> 
<uses-feature 
     android:name="android.hardware.camera" 
     android:required="false" /> 
    <uses-feature 
     android:name="android.hardware.camera.autofocus" 
     android:required="false" /> 
    <uses-feature 
     android:name="android.hardware.camera.flash" 
     android:required="false" /> 

然後,這個類中,我嘗試打開scanActivity(CardIOActivity)

private static void launchCardIoPhoto(Context ctx) { 
     if (!(ctx instanceof Activity)) return; 
     //Intent scanIntent = new Intent("android.media.action.IMAGE_CAPTURE"); 
     Intent scanIntent = new Intent(ctx, CardIOActivity.class); 
     //scanIntent.putExtra(CardIOActivity.EXTRA_APP_TOKEN, CARD_IO_API_KEY); 
     scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, false); 
     scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_POSTAL_CODE, false); 
     scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CVV, false); 
     scanIntent.putExtra(CardIOActivity.EXTRA_SUPPRESS_MANUAL_ENTRY, true); 
     scanIntent.putExtra(CardIOActivity.EXTRA_USE_CARDIO_LOGO, true); 
     BankokApplication.app().ignoreNextResume(); 

     Fragment fragment = ((Activity) ctx).getFragmentManager().findFragmentById(R.id.bottom_sheet_container); 
     if (fragment != null && fragment instanceof CardScanReceiver){ 
      fragment.startActivityForResult(scanIntent, REQ_CODE_CARD_IO_PHOTO); 
     }else { 
      ((Activity) ctx).startActivityForResult(scanIntent, REQ_CODE_CARD_IO_PHOTO); 
     } 
    } 

,當我嘗試這樣做,我有這樣的事情: enter image description here

評論更新:

測試在

  • 華碩Z00AD(Zenphone)
  • 華爲
  • 的Nexus 5
  • Genymotion

從card.io按預期方式工作的示例應用程序

編輯

查找錯誤:

No implementation found for boolean io.card.payment.CardScanner.nUseX86() (tried Java_io_card_payment_CardScanner_nUseX86 and Java_io_card_payment_CardScanner_nUseX86__) 
Failed to load native library: No implementation found for boolean io.card.payment.CardScanner.nUseX86() (tried Java_io_card_payment_CardScanner_nUseX86 and Java_io_card_payment_CardScanner_nUseX86__) 
+0

你在測試什麼設備? – antonio

+0

華碩Z00AD(Zenphone),華爲,Nexus 5和Genymotion – metalink

回答

0

修復問題。 該項目是之前版本card.io的本機庫,在刪除庫數據後它正常工作。

+0

什麼是圖書館數據?你是指Android項目中的libs目錄嗎? –

0

看來,card.io無法初始化設備相機並落到手動輸入。

如果您的設備有一個攝像頭,檢查相機不使用,並添加到您的清單(從the documentation),以避免需要相機的unnecesary funcitionalities:

<!-- Camera features - recommended --> 
<uses-feature android:name="android.hardware.camera" android:required="false" /> 
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" /> 
<uses-feature android:name="android.hardware.camera.flash" android:required="false" /> 

而且,如果您的設備運行Android 6並且用戶拒絕相機權限,則card.io將落入手動卡輸入。

+0

它在項目中,我忘記插入投票 – metalink

+0

相機在使用嗎?試過重新啓動設備? – antonio

+0

相機按順序排列。不要重啓設備。從圖書館下載應用程序,它工作正常 – metalink