简体   繁体   English

使用 NDEF 格式的 Android HCE 并使用 iOS CoreNFC 阅读器应用程序读取它

[英]Android HCE with NDEF format and use iOS CoreNFC reader app to read it

I have developed an android app with HCE function and want to send the string to iPhone by CoreNFC .我开发了一个带有 HCE 功能的 android 应用程序,并希望通过CoreNFC将字符串发送到 iPhone。 So I have used NFCReaderiOS , this example to verify whether success or not.所以我使用了NFCReaderiOS ,这个例子来验证是否成功。 The following code is the android part that I used to return data to the iOS NFC reader app:以下代码是我用来将数据返回到 iOS NFC reader应用程序的 android 部分:

@Override
public byte[] processCommandApdu(byte[] bytes, Bundle bundle) {
    if (Arrays.equals(bytes, APDU_SELECT)) {
        NdefMessage message = createTextMessage("Testing123");
        return message.toByteArray();
    } else {
        return A_ERROR;
    }
}

However, the iOS NFC reader app cannot capture any response that the android part returned.但是,iOS NFC reader应用程序无法捕获 android 部分返回的任何响应。 In this case, the function processCommandApdu is triggered by the iOS reader app.在这种情况下,函数processCommandApdu由 iOS 阅读器应用程序触发。 Is there any solution to emulate the NDEF tag by android HCE other than the above method?除了上述方法,是否有任何解决方案可以通过 android HCE模拟NDEF标签? Thanks a lot.非常感谢。

I do not think that iOS supports anything other than the NDEF APDU.我认为 iOS 不支持 NDEF APDU 以外的任何东西。

Section 5 of http://apps4android.org/nfc-specifications/NFCForum-TS-Type-4-Tag_2.0.pdf Should provide all the details how how to correctly emulate a type 4 tag with an NDEF message on it. http://apps4android.org/nfc-specifications/NFCForum-TS-Type-4-Tag_2.0.pdf 的第 5 节应提供如何正确模拟带有 NDEF 消息的类型 4 标签的所有详细信息。

Also some more details on https://stackoverflow.com/a/29127714/2373819还有一些关于https://stackoverflow.com/a/29127714/2373819 的更多细节

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM