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

Nico K 0 Reputation points
2024-02-29T18:39:22.2433333+00:00

was first posted as issue here: https://github.com/microsoft/microsoft-ui-xaml/issues/9358

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 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 NuGet package version

WinUI 3 - Windows App SDK 1.4.5: 1.4.240411001 Windows version

Windows 11 (22H2): Build 22621, Windows 11 (21H2): Build 22000

---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?

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
727 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,342 questions
{count} votes