-
Notifications
You must be signed in to change notification settings - Fork 802
Open
Labels
difficulty/starter 🚀Categorizes an issue for which the difficulty level is reachable by newcomersCategorizes an issue for which the difficulty level is reachable by newcomerskind/bugSomething isn't workingSomething isn't workingproject/non-ui ⚙️Categorizes an issue or PR as relevant to winrt (non-ui)Categorizes an issue or PR as relevant to winrt (non-ui)
Description
Current behavior
Although there is no accelerometer sensor in my desktop device, the Accelerometer.GetDefault(); still returns some Accelerometer with empty values.
Sensor tester on the same device:
Expected behavior
The Accelerometer.GetDefault(); should return null.
How to reproduce it (as minimally and precisely as possible)
var accelerometer = Accelerometer.GetDefault();
if (accelerometer != null)
{
accelerometer.ReadingChanged += Accelerometer_ReadingChanged;
}
else
{
// Accelerometer is not available on this platform/device.
}
private void Accelerometer_ReadingChanged(Accelerometer sender, AccelerometerReadingChangedEventArgs args)
{
LastReadTimestamp = args.Reading.Timestamp;
AccelerationX = args.Reading.AccelerationX;
AccelerationY = args.Reading.AccelerationY;
AccelerationZ = args.Reading.AccelerationZ;
}
Workaround
No response
Works on UWP/WinUI
Yes
Environment
No response
NuGet package version(s)
No response
Affected platforms
WebAssembly
IDE
Visual Studio 2022
Anything else we need to know?
In TypeScript there is some new method for getting the sensor, so maybe that could be a solution.
Copilot
Metadata
Metadata
Assignees
Labels
difficulty/starter 🚀Categorizes an issue for which the difficulty level is reachable by newcomersCategorizes an issue for which the difficulty level is reachable by newcomerskind/bugSomething isn't workingSomething isn't workingproject/non-ui ⚙️Categorizes an issue or PR as relevant to winrt (non-ui)Categorizes an issue or PR as relevant to winrt (non-ui)