You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android平台NfcV标签Payload读取异常问题求助

Android NFCV标签读取:复现C#端Payload读取结果

在Android Studio Java项目中,尝试读取NdefFormatable和NfcV类型的特定标签Payload。已通过Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);识别标签,创建NfcV对象后执行了以下代码:

NfcV nfcV = NfcV.get(tag);
byte[] data = new byte[0];

byte[] id = tag.getId();

if (nfcV != null) {

    byte[] infoCmd = new byte[2 + id.length];
    // set "addressed" flag
    infoCmd[0] = 0x20;
    //   Get System Information command byte
    infoCmd[1] = 0x2B;
    //adding the tag id
    System.arraycopy(id, 0, infoCmd, 2, id.length);

    System.arraycopy(id, 0, infoCmd, 2, 8);
    try {
        nfcV.connect();
        // infoCmd VALUE: [32, 43, 107, 32, -61, -97, 116, 77, 2, -32]
        // DATA RESULT:   [0, 11, 107, 32, -61, -97, 116, 77, 2, -32, -1, 0, 78]
        data = nfcV.transceive(infoCmd);

    } catch (IOException e) {
        e.printStackTrace();
    } finally {
        try {
            nfcV.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

问题:nfcV.transceive(infoCmd)返回的数据不符合预期,无法确定是infoCmd指令内容错误,还是该方式无法获取设备Payload。

补充说明:同款NFC设备在C#中可通过ProximityDevice对象获取Payload,代码如下:

ProximityMessage message;
var rawMsg = message.Data.ToArray();

需求:需在Android应用中复现C#端rawMsg的结果,实现相同的Payload读取。

内容的提问来源于stack exchange,提问作者Gabriel Palmeri

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.29 02:37:36