rdelrosario / xamarin-plugins

Cross platform Xamarin & Windows plugins for PCLs
MIT License
179 stars 161 forks source link

DeviceMotion on Android uses deprecated SensorType #98

Open EFinley opened 7 years ago

EFinley commented 7 years ago

Hmmm... I've been quite happy with this library for accelerometer & gyroscope use, but now that I come to working with angle-in-space and have been doing some reading on it, it sounds like Android has pretty strongly deprecated the previous "SensorType.Orientation" - see docs. Should I assume therefore that this toolkit isn't compatible with the current standard they're trying to enforce, and work on my own? Is there perhaps background / beta work being done on a more current version?

dimitrijevic commented 7 years ago

Have you done any Xamarin code using the rotation matrix? As far as I can tell this is the same idea as you can use on Windows that's suppose to reduce the orientation calculations done in user code and have those values read out directly from a sensor fusion of some sort...doing orientation calculations in user code and not getting them directly from the native drivers affected accuracy if you have another compute intensive process running along with this plugin...I don't have much experience with Xamarin.Android or .iOS directly so I'd love to hear from someone that does this on those platforms (or develops real innertion navigation devices using sensor fusion) but I also think since not all smartphone devices have anything more than an just an accelerometer I sincerely doubt it will ever stop working and be anything more than deprecated, since on those low-cost devices there's nothing to fuse with used accelerometer values like gyro or compass heading values.

dimitrijevic commented 7 years ago

I've started some work on extending the current version of the DeviceMotion plugin, but I'm only incline (pun intended) to use and test Windows (Phone) devices for now...if you'd (or anyone else) would like to join in to extend the Android and/or iOS to get the fusioned sensor readings available in the plugin for those platforms it'd be great...if not, but if you'd still like to test the newly extended Inclinometer (thus the pun) fusion sensor readings by trying to use MotionSensorType.Fusion readings please try: https://www.nuget.org/packages/Xam.Plugin.DeviceMotion2/2.0.0-gamma (I'll do a pull request on the code for @rdelrosario as soon as I test it out on a few more devices - or better yet have someone add more code or input for which other fusion sensors to try and add and how to call them - I also changed the namespaces).