MicrosoftDocs / winrt-api

WinRT reference content for developing Microsoft Universal Windows Platform (UWP) apps
Creative Commons Attribution 4.0 International
231 stars 500 forks source link

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

Open minze-it opened 7 months ago

minze-it commented 7 months ago

Just wanted to mention an issue from the WindowsAppSDK that somehow doesn't have any place right to be posted/reported. https://github.com/microsoft/WindowsAppSDK/issues/4356

Describe the bug

was first posted as issue here: 

https://github.com/microsoft/microsoft-ui-xaml/issues/9358
then here: https://learn.microsoft.com/en-us/answers/questions/1604064/windows-app-proximitydevice-nfc-events-not-trigger
reported via feedback hub...
contacted our Microsoft consultant
He sent us back to this... this is really frustrating - nobody really cares

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

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?