Make dialog to call DeviceMotionEvent.requestPermission in iOS 13+
See original GitHub issue8th wall dialog is a good example to follow (open link on iOS 13)
https://apps.8thwall.com/8w/jini/
requestPermision has to be called in a handler triggered by a user gesture
buttonEl.addEventlistener('click', function () {
DeviceMotionEvent.requestPermission().then(response => {
if (response == 'granted') {
window.addEventListener('devicemotion', (e) => {
// do something with e
})
}
}).catch(console.error)
});
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:23 (16 by maintainers)
Top Results From Across the Web
How to requestPermission for devicemotion and ...
To request permission, we would just need to call a method on the DeviceMotionEvent or DeviceOrientationEvent : requestPermission It ...
Read more >How to Request Device Motion and Orientation Permission in ...
Learn how to Request Device Motion and Orientation Permission in iOS 13. ... Just be sure to call the associated requestPermission() method from...
Read more >mobile safari - DeviceMotionEvent.requestPermission() throws ...
I have a web page that I'm loading in Safari on iOS 13.4.1. The web page calls ...
Read more >ios 13 and DeviceOrientationEvent.requestPermission
I'm now attempting to trigger the permission dialog at startup and I can't seem to get it to fire without linking it to...
Read more >Unable to check DeviceOrientationEvent - Apple Developer
requestPermission () .then(permissionState => { if (permissionState ... else { // handle regular non iOS 13+ devices console.log ("not iOS"); } }.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So, here is what I think:
The
DeviceMotion
permission is something that the developer using the platform should deal with. It means thataframe
itself should not be responsible to make this request.Although, I think that we should do add the banner as an option to be inserted when
aframe
loads and use it in the exemples provided. This will help developers to get things done.I’ve done this, based on the home website. I’m also making the IOS 12 version, with the step-by-step on how enable it.
Here is the code (still polishing): https://codepen.io/davimello28/pen/MWWOKar
For the
lazyproductive developersHere is a full working exemple:
Fixed by https://github.com/aframevr/aframe/pull/4303