DeviceOrientationEvent in iOS 13 needs User permission

Dear all,

window.addEventListener(“deviceorientation”, function (event) {

does’t seem to work anymore with iOS 13, maybe because of the needed user permission now.
In normal mobile browsers like Safari and so on, getting user permission by calling

if (typeof DeviceOrientationEvent.requestPermission === 'function') {
   DeviceOrientationEvent.requestPermission()

is working, though it is not supported with Ionic 5 in iOS App.

Any help is much appreciated!

Thank you!

Yes, it seems you need to requestPermission for this to work in iOS 13+.

The problem is that it is not a good user experience, because it not persisted, so it will ask for permission every time the app starts. It also says “localhost” wants permission and not app name.

1 Like

@ingljo did you find a way to make this experience better? “localhost” is a bummer and I didn’t know the user needs to authorize every time he opens the app… that’s a real feature killer… :frowning: