Can Poyrazoğlu
Can Poyrazoğlu

Reputation: 34780

How to read any NFC binary message with Windows Phone 8

I am developing an NFC app for Windows Phone and I want to subscribe to any binary message. How can I achieve a functionality like nfc.SubscribeForAnyMessage( HandleNFCMessage); ? Currently I can only subscribe to a specific message type such as nfc.SubscribeForMessage("NDEF", HandleNFCMessage);

Thanks,

Can.

Upvotes: 1

Views: 3282

Answers (3)

aspark
aspark

Reputation: 1

Windows Phone 8 supports only "NDEF" formatted tags. http://www.developer.nokia.com/Community/Wiki/Use_NFC_tags_with_Windows_Phone_8

Upvotes: 0

JustinAngel
JustinAngel

Reputation: 16102

What'a a "Binary NFC" message? All messages handled within the WP8/Win8 proxmity framework must have a message type. "Binary messages" in this context are just messages that have a byte array (IBuffer) payload but still have a message type.

I don't believe it's possible to subscribe to a wildcard of NFC messages. You can definitely signup to some basic types of MessageTypes (like NDEF, etc) but every app can declare their own custom message type like Windows.MyApp.MyMessage that won't be caught by a wildcard.

What exactly are you trying to do? If you're just trying to know when an NFC tag is available to write over it consider using DeviceArrived and DeviceDeparted events.

Upvotes: 0

la_fusion
la_fusion

Reputation: 461

You have to specify the MessageType as the only method to subscribe for message is the method you already mentioned. To see what MessageTypes can be specified see the documentation of the PublishBinaryMessage: http://msdn.microsoft.com/en-us/library/windows/apps/hh701129.aspx

Perhaps if you specify "Windows" as MessageType you will get all binary messages but I can't test that right now. You can always subscribe your app to multiple MessageTypes.

Upvotes: 3

Related Questions