欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android實(shí)現(xiàn)銀行卡號(hào)掃描識(shí)別功能

 更新時(shí)間:2018年09月06日 08:37:34   作者:Jersey_me  
這篇文章主要為大家詳細(xì)介紹了Android實(shí)現(xiàn)銀行卡號(hào)掃描識(shí)別功能,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

現(xiàn)在有好多掃描識(shí)別銀行卡號(hào)的SDK都是收費(fèi)的,但是也有不收費(fèi)的,但是有一定的問題,就是那種印刷的銀行卡號(hào)掃描不出來,希望哪位大神指導(dǎo)原因給解釋下,這個(gè)不收費(fèi)的SDK就是card.io-Android-SDK,githubdi地址

使用方式很簡(jiǎn)單,更多介紹可以看GitHub 使用文檔

首先導(dǎo)入依賴:compile 'io.card:android-sdk:5.5.1'

然后在你需要調(diào)用拍照的地方加上一下:

Intent scanIntent = new Intent(this, CardIOActivity.class);

// customize these values to suit your needs.
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_EXPIRY, true); // default: false
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_CVV, false); // default: false
scanIntent.putExtra(CardIOActivity.EXTRA_REQUIRE_POSTAL_CODE, false); // default: false

// MY_SCAN_REQUEST_CODE is arbitrary and is only used within this activity.
startActivityForResult(scanIntent, MY_SCAN_REQUEST_CODE);

在onActivityForResult中接收結(jié)果:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  super.onActivityResult(requestCode, resultCode, data);

  if (requestCode == MY_SCAN_REQUEST_CODE) {
    String result;
    if (data != null && data.hasExtra(CardIOActivity.EXTRA_SCAN_RESULT)) {
      CreditCard scanResult = data.getParcelableExtra(CardIOActivity.EXTRA_SCAN_RESULT);

      // Never log a raw card number. Avoid displaying it, but if necessary use getFormattedCardNumber()
      result = "Card Number: " + scanResult.getRedactedCardNumber() + "\n";

      if (scanResult.isExpiryValid()) {
        result += "Expiration Date: " + scanResult.expiryMonth + "/" + scanResult.expiryYear + "\n";
      }

      if (scanResult.cvv != null) {
        // Never log or display a CVV
        result += "CVV has " + scanResult.cvv.length() + " digits.\n";
      }

      if (scanResult.postalCode != null) {
        result += "Postal Code: " + scanResult.postalCode + "\n";

      }
    } else {
      result = "Scan was canceled.";
    }
    Log.e("resultdispalyStr----",result);

  }
}


以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論