我有一個您想要掃描該卡的項目。爲了這個任務,我使用庫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);
}
}
評論更新:
測試在
- 華碩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__)
你在測試什麼設備? – antonio
華碩Z00AD(Zenphone),華爲,Nexus 5和Genymotion – metalink