我正在尝试在我的应用中实施Card.io
,我按照Card.io website上的说明操作,当我进入我的应用程序并启动它时,它锁定了我的卡,但之后没有别的发生了。以下是我的代码
AndroidManifest
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<--!..........................-->
<activity android:name="io.card.payment.CardIOActivity" android:configChanges="keyboardHidden|orientation" android:hardwareAccelerated="true"/>
<activity android:name="io.card.payment.DataEntryActivity" android:screenOrientation="portrait"/>
ActivityResult
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == MY_SCAN_REQUEST_CODE) {
String cardNumbs, cardExp, cardCVV;
String resultStr;
if (data != null && data.hasExtra(CardIOActivity.EXTRA_SCAN_RESULT)) {
//TODO
CreditCard scanResult = data.getParcelableExtra(CardIOActivity.EXTRA_SCAN_RESULT);
cardNumbs = scanResult.getRedactedCardNumber();
acctDebitCardNo.setText(cardNumbs);
if (scanResult.isExpiryValid()) {
cardExp = scanResult.expiryMonth + "/" + "20" + scanResult.expiryYear;
acctDebitCardExp.setText(cardExp);
} else {
acctDebitCardExp.setError("Card Has Expired");
}
if (scanResult.cvv != null) {
cardCVV = scanResult.cvv;
acctDebitCardCvv.setText(cardCVV);
}
}
}
}
午餐相机许可
Intent scanIntent = new Intent(getActivity(), CardIOActivity.class);
// customize these values to suit our/there needs...LOL :).
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, true);
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CVV, true);
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_POSTAL_CODE, false); // default: false
// hides the manual entry button
// if set, developers should provide their own manual entry mechanism in the app
scanIntent.putExtra(CardIOActivity.EXTRA_SUPPRESS_MANUAL_ENTRY, false); // default: false
// matches the theme of your application
scanIntent.putExtra(CardIOActivity.EXTRA_KEEP_APPLICATION_THEME, true);
// MY_SCAN_REQUEST_CODE is arbitrary and is only used within this activity.
startActivityForResult(scanIntent, MY_SCAN_REQUEST_CODE);
我不知道自己做错了什么
答案 0 :(得分:1)
答案 1 :(得分:0)
卡号是否浮雕?有关不支持非浮雕卡的原因说明,请参阅card-io / card.io-iOS-SDK#20。
答案 2 :(得分:0)
在我自己的情况下,问题是该卡没有压花(大多数尼日利亚卡没有压花)。 Card.io和PayCards不适用于浮雕卡。如果这种情况适合您,您可能需要使用Firebase MLKit自己构建扫描仪。整个过程没有听起来那么复杂。您可以按照this guide进行帮助。
我希望这会有所帮助。快活的编码!