microsoft / microsoft/WindowsAppSDK

ProximityDevice NFC events not triggered / NFC doesn't work at all

Open
#4,356 12 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-External
Dominant language
C++
Stars
4.7k
Forks
471
Avg merge
3d 13h
Merged PRs (30d)
28

Description

Describe the bug

We have an app that we migrated from UWP to WinUI 3 a while ago.
Unfortunately, we discovered that with the WinUI 3 app the ProximityDevice NFC feature no longer triggers events / no longer works at all. We use simple code that can be found in many examples and have set
<DeviceCapability Name="proximity"/>

var proximityDevice = Windows.Networking.Proximity.ProximityDevice.GetDefault();
var messageSubscriptionId = proximityDevice.SubscribeForMessage("NDEF", (device, message) =>
{
    Console.WriteLine(message.Data.ToArray());
});

this works in UWP and doesn't work in WindowsAppSDK/WinUI3 App
See min Repo examples
Works: https://github.com/minze-it/BlankProximityUWP
Doesn't work: https://github.com/minze-it/BlankProximityMaui

Steps to reproduce the bug
  • Start min repo apps
  • Click Button
  • Try read a NDEF 213/215/216 Tag which contains a NDEF message
Expected behavior

SubscribeForMessage delegate handler is invoked

Screenshots

No response

NuGet package version

Windows App SDK 1.5.2: 1.5.240404000

Packaging type

Packaged (MSIX)

Windows version

Windows 11 version 22H2 (22621, 2022 Update)

IDE

Visual Studio 2022

Additional context

What do I need to do to use NFC in a WindowsAppSDK app, or where should I report a bug for errors affecting Windows.Networking.Proximity?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the ProximityDevice.GetDefault and SubscribeForMessage("NDEF") usage shown in the issue, then compare the working BlankProximityUWP repository with the non-working BlankProximityMaui repository. Reproduce with a packaged Windows App SDK 1.5.2 app, the proximity DeviceCapability, and an NDEF 213/215/216 tag. Done means the SubscribeForMessage handler is invoked, or the platform limitation and required reporting path are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.