locked
How to read NFC TAG can add a message in there?

    Question

  • Is it possible to read how you can add a message in the NFC TAG?

    I think it comes into contact with the Windows8 pc the NFC TAG, you can add a message , contact When you have finished the NFC TAG, you want summoned messages that have been added .

    As it is, or more access in MessageRecievdHandler is impossible.

    ProximityDevice proximityDevice;
    long publishedMessageId;
    long subscribedMessageId;
     
    public MainPage ()
     
    {
           
    this.InitializeComponent ();
           
    proximityDevice = ProximityDevice.GetDefault ();

           
    if (proximityDevice! = null)
           
    {
                
    proximityDevice.DeviceArrived + = proximityDevice_DeviceArrived;
                
    proximityDevice.DeviceDeparted + = proximityDevice_DeviceDeparted;
           
    }
     
    }


    private void proximityDevice_DeviceDeparted (ProximityDevice sender)
     
    {
           
    proximityDevice.StopPublishingMessage (publishedMessageId);
           
    Debug.WriteLine ("Depart");
           
    subscribedMessageId = proximityDevice.SubscribeForMessage ("Windows.SampleMessage", messageReceived);
    }

    private void proximityDevice_DeviceArrived (ProximityDevice sender)
    {
          
    publishedMessageId = proximityDevice.PublishMessage ("Windows.SampleMessage", "Hello");
          
    Debug.WriteLine ("Arrived");
     
    }


    private void messageReceived (Windows.Networking.Proximity.ProximityDevice device, Windows.Networking.Proximity.ProximityMessage message)
    {
         
    Debug.WriteLine (message.DataAsString);
    }

    I want to know is where are incorrect or not between the part that you code .

    Thursday, March 06, 2014 5:47 AM

Answers