You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a project right now, and managed to get DeviceMotion approval flow working.
this function must be triggered as a result of user interaction!!
This triggers a pop-up on iOS. Once the user grants permission, this library (and in theory all subsequent DeviceMotion calls) should work.
functionclickHandler(){try{//try block bc Safariif(typeofDeviceMotionEvent.requestPermission==="function"){DeviceMotionEvent.requestPermission().then((permissionState)=>{if(permissionState==="granted"){window.addEventListener("devicemotion",(e)=>{console.log(e);});}}).catch(console.error);}else{// handle regular non iOS 13+ devices}}catch(e){}}
I threw in the try block because Safari of all browsers fails to call DeviceMotionEvent iirc
I don't have the moment to test but you might be able to get away with just calling DeviceMotionEvent.requestPermission()
Hello all, this was a great effect while...while it worked on IOS devices.
I’m surprised there has been no comment on this being non-functional across all IOS devices.
The text was updated successfully, but these errors were encountered: