使用 card.io 扫描名片
Scanning card with card.io
我有一个项目,您要在其中扫描名片。对于此任务,我使用库 card.io。最近我更新了库到最新版本(5.4.0) 现在,而不是扫描卡更改为手动输入。我做错了什么?所有设置均根据说明进行。
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" />
然后,我尝试在其中 class 打开 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)
- 华为
- 连结 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__)
好像card.io无法初始化设备相机,落到手动输入
如果您的设备有摄像头,检查摄像头是否未使用,并将其添加到您的清单(来自 the documentation)以避免需要不必要的功能相机:
<!-- 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" />
此外,如果您的设备运行Android6并且用户拒绝了相机权限,card.io将陷入手动卡片输入。
修复问题。
该项目是以前版本的本机库 card.io 在删除库数据后它可以正常工作。
我有一个项目,您要在其中扫描名片。对于此任务,我使用库 card.io。最近我更新了库到最新版本(5.4.0) 现在,而不是扫描卡更改为手动输入。我做错了什么?所有设置均根据说明进行。
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" />
然后,我尝试在其中 class 打开 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)
- 华为
- 连结 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__)
好像card.io无法初始化设备相机,落到手动输入
如果您的设备有摄像头,检查摄像头是否未使用,并将其添加到您的清单(来自 the documentation)以避免需要不必要的功能相机:
<!-- 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" />
此外,如果您的设备运行Android6并且用户拒绝了相机权限,card.io将陷入手动卡片输入。
修复问题。 该项目是以前版本的本机库 card.io 在删除库数据后它可以正常工作。