NFC to have a Skype call with Windows 8.1

Check this blog if you want to rich your application with the availability to have a skype call with your friends from your app just using your NFC

ProximityDevice has made life easier to publish content that can be received by other NFC readable devices.
We can publish a uri to tag, we can publish a http:// protocol and it will launch the web link in the browser. So we can publish the uri to skype call.

  1. privatevoidWriteSkypeTag(string skypeUsername)
  2. {
  3. var device =ProximityDevice.GetDefault();
  4. if(device !=null)
  5. {
  6. using(var writer =newDataWriter{UnicodeEncoding=UnicodeEncoding.Utf16LE})
  7. {
  8. // Prepare the message to be published.
  9. var uri =string.Format(“skype:{0}?call”, skypeUsername);
  10. writer.WriteString(uri);
  11. var buffer = writer.DetachBuffer();
  12.  
  13. // Publish the message. You must tap an NFC tag to your device to write
  14. // the content to it.
  15. device.PublishBinaryMessage(“WindowsUri:WriteTag”, buffer,
  16. async (sender, messageId)=>
  17. {
  18. device.StopPublishingMessage(messageId);
  19.  
  20. await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, async ()=>
  21. {
  22. var message =newMessageDialog
  23. (“The Skype contact has been written to the tag.”);
  24. await message.ShowAsync();
  25. });
  26. });
  27. }
  28. }
  29. }

We used the skype uri to create the link, for example the uri is skype:amrsader? call so this will open the skype and call the contact which is amrsaderin this case then using the WindowsUri:WriteTag we specified that its a uri can only be transmitted to a tag. Now we only need to tap the tag to the device and it will work.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s