dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.05k stars 1.73k forks source link

[Enhancement] LinearAccelerationSensor on Android #736

Open BurkusCat opened 3 years ago

BurkusCat commented 3 years ago

Summary

The current Xamarin.Essentials Accelerometer provides generic access to an accelerometer sensor across the platforms. It would be good to allow a way to change the requested sensor to be the LinearAccelerationSensor on Android only. The LinearAccelerationSensor excludes gravity from the readings which is very handy.

https://developer.android.com/guide/topics/sensors/sensors_motion#sensors-motion-linear https://github.com/dotnet/maui/blob/main/src/Essentials/src/Accelerometer/Accelerometer.android.cs

API Changes

Add an optional method parameter for the type of sensor you want to request. It falls back to Accelerometer on any platforms where other platforms are not supported.

public static void Start(SensorSpeed sensorSpeed, AccelerometerType? accelerometerType);
public enum AccelerometerType
{
    Accelerometer = 0,
    AccelerometerUncalibrated = 1, // why not? :)
    LinearAcceleration = 2,
    Gravity = 3, // why not? :)
}
Accelerometer.Start(SensorSpeed.UI, AccelerometerType.LinearAcceleration);

Intended Use Case

Linear acceleration data is very useful. There are lots of times when you want to exclude gravity from any measurements.

ghost commented 2 years ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

Gio-Arch commented 1 year ago

can I please have an update on this issue? I'd like to use linear accelerator on Maui Thanks