Apple made changes in iOS 12.2 by default removing motion sensors from mobile Safari, which was also done recently by Chrome. However, in iOS 13, a requestPermission popup was added back.
.then(response => {
if (response == 'granted') {
window.addEventListener('devicemotion', (e) => {
// do something with e
})
}
})
.catch(console.error)
This solution is effective for mobile browsers and they are now functioning properly.
I am encountering issues on non-mobile browsers such as Edge Chromium and Chrome.
Uncaught TypeError: window.DeviceMotionEvent.requestPermission is not a function at game.start_handling (game.js:706)
I believe I need to check if the method or function exists before calling it. Any recommendations?