I'm looking for a way to check if a device supports either the DeviceOrientationEvent or DeviceMotionEvent. To be more precisely I wan't to know if the device really has an accelerometer.
Unfortunately window.DeviceMotionEvent
and window.ondevicemotion
respectively window.DeviceOrientationEvent
and window.ondeviceorientation
exists although the device - MacBook Retina - doesn't have an accelerometer.
It's clear to me, that if the Event is never fired, the callback-function of an eventlistener will also never run. But in my case I, my program need's to know if the device has an accelerometer, because the user should receive a notification if there is no accelerometer.
Answers of this post unfortunately didn't work for my problem.