W3C home > Mailing lists > Public > public-device-apis-log@w3.org > March 2019

Re: [deviceorientation] Add API for requesting permission to receive device motion / orientation events (#57)

From: Paul Neave via GitHub <sysbot+gh@w3.org>
Date: Mon, 25 Mar 2019 21:47:38 +0000
To: public-device-apis-log@w3.org
Message-ID: <issue_comment.created-476390630-1553550457-sysbot+gh@w3.org>
> No, it doesn't. I cannot comment on _when_ it will ship but I have already agreed to post a message on this issue when the permission API becomes available in a public beta.

This is disappointing. I hope the API will make it into an update soon.

For anyone looking for a workaround, the best thing to do is to detect the disabled state via a timeout and clear it in the event handler. Something like this:

```
const id = setTimeout(() => alert('Enable device orientation in Settings > Safari > Motion & Orientation Access.'), 500);

window.addEventListener('deviceorientation', event => {
	clearTimeout(id);
	// ...
});
```



-- 
GitHub Notification of comment by neave
Please view or discuss this issue at https://github.com/w3c/deviceorientation/issues/57#issuecomment-476390630 using your GitHub account
Received on Monday, 25 March 2019 21:47:39 UTC

This archive was generated by hypermail 2.3.1 : Monday, 25 March 2019 21:47:40 UTC