Take the 2-minute tour ×

I got Windows Phone 8 device, few NDEF formatted NFC tags and I'm wondering, is it possible to implement app launching on my WP8 using these tags? I've read thoroughly this article about URI schemes for launching built-in apps for Windows Phone 8, but I haven't found any link related to actual launching of 3rd party apps. I can launch various settings screens, or browser, email, SMS...

What is more interesting, that there are at least two NFC tags on WP Store that can "write tags for launching apps", I've tried them, but the launching is just not working.

So the question is: is it possible to store on NFC tag information for launching any 3rd party app on WP8? If yes, what is the format of such URI scheme and how to write it to a tag using WP8?

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

Yes, you can launch any Windows Phone 8 app using an NFC tag. You need to put an NDEF message on the tag that has a LaunchApp record as the first record. Set the platform ID in the payload of the NDEF record to "WindowsPhone" and set the app ID to the hex string at the end of Windows Phone store URL between "{" and "}" For example, for http://www.windowsphone.com/en-us/store/app/stackoverflow-feeds/226fcc72-69ff-4a85-b945-cbb7f5ea00af to "{226fcc72-69ff-4a85-b945-cbb7f5ea00af}".

This library can help to create such NDEF records. Limited documentation from MS is available here.

share|improve this answer
Hey, it works. I've tried another app and it wasn't working, then tried NFC Interactor and it worked. But I have a question, Is this somewhere documented on MSDN pages as well? –  Martin Suchan Nov 24 '12 at 11:21
All online information I am aware of I have already linked to in my answer. –  NFC guy Nov 24 '12 at 19:54
add comment

To launch your app via a NFC tag, you need to Register it for a URI association by adding an extension in the WMAppManifest.xml file, like this:

  <Protocol Name="mynfcapp" NavUriFragment="encodedLaunchUri=%s" TaskID="_default" />

Then you will need to create a URI mapper that can handle the URI association, like this:

public class AssociationUriMapper : UriMapperBase
    public override Uri MapUri(Uri uri)
        string url = HttpUtility.UrlDecode(uri.ToString());

        if (url.Contains("mynfcapp:MainPage"))
            int paramIndex = url.IndexOf("source=") + 7;
            string paramValue = url.Substring(paramIndex);

            return new Uri("/MainPage.xaml?source=" + paramValue, UriKind.Relative);

        return uri;

And here is the code to write the NFC tag that will launch the app:

public partial class MainPage : PhoneApplicationPage
    private readonly ProximityDevice _proximityDevice;
    private long subId = 0;
    private long pubId = 0;

    public MainPage()
        _proximityDevice = ProximityDevice.GetDefault();

    protected override void OnNavigatedTo(NavigationEventArgs e)
        if (_proximityDevice != null)
            subId = _proximityDevice.SubscribeForMessage("WriteableTag", OnWriteableTagArrived);

    private void OnWriteableTagArrived(ProximityDevice sender, ProximityMessage message)
        var dataWriter = new DataWriter();
        dataWriter.UnicodeEncoding = Windows.Storage.Streams.UnicodeEncoding.Utf16LE;
        string appLauncher = string.Format(@"mynfcapp:MainPage?source=mynfctest");
        pubId = sender.PublishBinaryMessage("WindowsUri:WriteTag", dataWriter.DetachBuffer());
share|improve this answer
I know about this protocol extension, but I was wondering if it's possible to launch just any app, if I know the App Id? –  Martin Suchan Nov 24 '12 at 11:04
add comment

Your Answer


