IsoDep 和 Android NFC - 未检测到支付卡

IsoDep and Android NFC - Payment Card not detected

我正在开发一个支付应用程序,全球的想法是将智能手机转换为 POS(移动 POS)

我在网上搜索了很多(这里也是!),我找到了我所有问题的一部分的答案,但它仍然是一个问题。

一切似乎都正确,但智能手机未检测到卡...

这是我的Manifest.xml(重要部分...)

<uses-feature
    android:name="android.hardware.nfc"
    android:required="true"/>

<use-permission 
    android:name="android.permission.NFC"/>

<action android:name="android.nfc.action.TECH_DISCOVERED" />

<meta-data 
    android:name="android.nfc.action.TECH_DISCOVERED"
    android.resource="@xml/nfc_tech_list"/>

在我的 nfc_tech_list.xml 中,我放入了 IsoDep、NfcA 和 NfcB。

目前,我只有一个 activity。这是代码:

private Toolbar mToolbar;
private NfcAdapter mNfcAdapter;

private final byte[] SELECT_PPSE = {
        (byte) 0x00, // CLA
        (byte) 0xA4, // INS
        (byte) 0x04, // P1
        (byte) 0x00, // P2
        (byte) 0x0E, // Lc
        0x32, 0x50, 0x41, 0x59, 0x2E, 0x53, 0x59, 0x53, 0x2E, 0x44, 0x44, 0x46, 0x20, 0x31,
        (byte) 0x00
};

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Setting the Action Bar
    mToolbar = (Toolbar) findViewById(R.id.toolbar);

    setSupportActionBar(mToolbar);
    getSupportActionBar().setDisplayShowHomeEnabled(true);

    // Checking if the NFC is enabled
    mNfcAdapter = NfcAdapter.getDefaultAdapter(this);

    if (!mNfcAdapter.isEnabled())
        Toast.makeText(this.getBaseContext(), "Veuillez activer le NFC dans vos paramètres", Toast.LENGTH_LONG).show();
}

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);

    // Is the intent for a new NFC Tag Discovery
    if (intent != null && intent.getAction() == NfcAdapter.ACTION_TECH_DISCOVERED) {
        Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
        IsoDep isoDep = IsoDep.get(tag);

        if (isoDep == null)
            Toast.makeText(this.getBaseContext(), "Bon début", Toast.LENGTH_LONG).show();
        else
            Toast.makeText(this.getBaseContext(), "Mauvais début", Toast.LENGTH_LONG).show();
    }
}

@Override
protected void onResume() {
    super.onResume();

    mNfcAdapter.enableForegroundDispatch(this,
            PendingIntent.getActivity(this,
                    0,
                    new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0),
            new IntentFilter[]{new IntentFilter(NfcAdapter.ACTION_TECH_DISCOVERED)},
            new String[][]{new String[]{IsoDep.class.getName()}}
    );

问题是根本没有检测到卡,而其他标签是...

有人可以帮我吗?

编辑:我正在使用 Galaxy Note 3 Lite

编辑 2:这是我的技术列表:

<?xml version="1.0" encoding="utf-8"?>
<resource xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <tech-list>
        <tech>android.nfc.tech.IsoDep</tech>
        <tech>android.nfc.tech.NfcA</tech>
        <tech>android.nfc.tech.NfcB</tech>
        <tech>android.nfc.tech.NfcF</tech>
        <tech>android.nfc.tech.NfcV</tech>
    </tech-list>
</resource>

你可以 post 你的技术清单吗?您可能无意中将卡片排除在过滤器之外。您希望卡片匹配哪些技术?

编辑: 试试这个:

<tech-list>
  <tech>android.nfc.tech.IsoDep</tech>
</tech-list>
<tech-list>
  <tech>android.nfc.tech.NfcA</tech>
</tech-list>
<tech-list>
  <tech>android.nfc.tech.NfcB</tech>
</tech-list>
<tech-list>
  <tech>android.nfc.tech.NfcF</tech>
</tech-list>
<tech-list>
  <tech>android.nfc.tech.NfcV</tech>
</tech-list>