【问题标题】:Can't open this message无法打开此消息
【发布时间】:2013-06-09 14:21:38
【问题描述】:

我正在编写一个 WP8 NFC 应用程序。

我从计算机向手机发送 (ndef) 消息。 在电话上我订阅了 NDEF 消息:_proximityDevice.SubscribeForMessage("NDEF", MessageReceivedHandler);

当我收到一条消息时,我的MessageReceiveHandler 会被调用,我可以处理该消息。

private async void MessageReceivedHandler(ProximityDevice sender, ProximityMessage message)
{
    var rawMsg = message.Data.ToArray();
    var ndefMsg = NdefMessage.FromByteArray(rawMsg);
    var ndefRec = ndefMsg[0];

    string recordType = Encoding.UTF8.GetString(ndefRec.Type, 0, ndefRec.Type.Length);

    Debug.WriteLine(recordType);
}

这很好用。但同时WP8显示一个消息框:

+---------------------------------------------+
| Can't open                                  |
|                                             |
| Sorry, your phone can't recognise this type |
| of file.                                    |
|                                             |
| [close]                                     |
+---------------------------------------------+

我是否必须在某个地方告诉 WP8 应用程序接受了该消息?或者为什么会出现该消息?

顺便说一句,我正在使用自定义 MIME 类型 application/ch.cimnine.myapp.v1。我是否必须以某种方式向 WP8 注册此 MIME-Type?

【问题讨论】:

  • 很遗憾,Windows Phone 8 操作系统的这种行为无法更改,您无法控制手机的 NFC 提示

标签: windows-phone-8 nfc mime ndef


【解决方案1】:

当您订阅 NDEF 协议时,您将收到所有 NDEF 消息,但操作系统会提示。

不幸的是Mimetype are prompted by WP8

为了避免提示消息,您可以使用Windows. protocol 或其他低级别的 NDEF 消息。

【讨论】:

    猜你喜欢
    • 2012-04-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-13
    • 1970-01-01
    • 1970-01-01
    • 2016-03-17
    相关资源
    最近更新 更多