首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >接近设备API - NDEF发布的参数异常

接近设备API - NDEF发布的参数异常
EN

Stack Overflow用户
提问于 2016-07-08 20:24:48
回答 1查看 268关注 0票数 1

我打算使用Windows邻近设备API编写二进制数据。

我可以发现NFC标签,我可以从标签中读取NDEF信息,写在Android手机上。

但是,当我试图设置一个PublishBinaryMessage时,当我使用这个messageTypes:"NDEF“、"WriteableTag”或除"Windows.someSubtype"之外的https://msdn.microsoft.com/en-us/library/windows/apps/hh701129.aspx 中描述的任何其他内容时,总是会收到ArgumentException (值不属于预期范围)。但在这种情况下,我的标签没有被扣动。

我得到了带有"NDEF.someSubtype“的NDEF.someSubtype,但是消息是"Message”参数是incorrect.This ProximityDevice不支持在messageType: NDEF.someSubtype中传递的内容。

守则:

代码语言:javascript
复制
//Does not work - Argument Exception - "Value does not fall within the expected range"
messageID = proximityDevice.PublishBinaryMessage("NDEF", Encoding.UTF8.GetBytes("lorem ipsum").AsBuffer(), MessageTransmittedHandler);

//Does not work - Argument Exception - "The parameter is incorrect"
messageID = proximityDevice.PublishBinaryMessage("NDEF.something", Encoding.UTF8.GetBytes("lorem ipsum").AsBuffer(), MessageTransmittedHandler);

//No Exception, but never writes on device.
messageID = proximityDevice.PublishBinaryMessage("Windows.something", Encoding.UTF8.GetBytes("lorem ipsum").AsBuffer(), MessageTransmittedHandler);
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-07-09 11:49:31

输入缓冲区错误。对于NDEF消息,API文档说:

消息内容是正确格式化的NDEF记录。

因此,使用Andijac (https://github.com/andijakl/ndef-nfc)的ndef-nfc库,可以正确地发布二进制消息。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38274866

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档