microsoft / microsoft/WindowsAppSDK
ProximityDevice NFC events not triggered / NFC doesn't work at all
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 4.7k
- Forks
- 471
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 28
Description
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
<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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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