MessageReceivedHandler in SubscribeForMessage does not work. RRS feed

  • Question

  • I think I want to create a Tag Reader App on Windows8.
    For example,I want to read the ID / DATA size/ Message of transportation card / credit card / debit card.
    However SubscribeForMessage does not work properly.

    proximityDevice.SubscribeForMessage ("NDEF", new MessageReceivedHandler ((proxDevice, message) =>
    Debug.WriteLine (message.DataAsString);

    I tried to let you referred to Debug.WriteLine receive the Message of all, but it does not appear.
    It does not stop even if unchecked breakpoint.
    I do not knowhow to doconduction.

    [I ran the Samsung Ativ pro]

    Wednesday, March 12, 2014 7:18 AM

All replies

  • Does it work if you create a specific handler function rather than placing it inline? e.g.:

    private void SubscribeForMessage(object sender, RoutedEventArgs e)
        // Only subscribe for the message one time.
        if (subscribedMessageId == -1)
            subscribedMessageId =
            proximityDevice.SubscribeForMessage("Windows.SampleMessage", messageReceived);

    private void messageReceived(
        Windows.Networking.Proximity.ProximityDevice device,
        Windows.Networking.Proximity.ProximityMessage message)
        MessageBlock.Text += "Message received: " + message.DataAsString + "\n";

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Wednesday, March 12, 2014 7:54 PM
  • Had above coding.
    But do not go just as messageReceived.
    Thursday, March 13, 2014 1:09 AM