Open paolobaiguera opened 4 years ago
Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.
It could possibly be a permission issue, I don't have an Android device to test but on iOS all of the accelerometer functions are not working because they now require an additional call to ask the users for permission to get the data. See more here. See also #4037.
A way to test whether it is the same problem for you, add the following to your code and press the button created, it should ask for permission and the sketch should work as expected.
function setup(){
btn = createButton("Motion");
btn.mousePressed(function(){
DeviceOrientationEvent.requestPermission();
});
}
Sorry for the long wait.. It was both the suggested problema and the fact that i did not use https (for Android). However deviceShaken() still not work on iOS 13+.
@paolobaigueraunitn Does it still not work with the example code I posted above? In iOS Safari you may need to enable it in Preferences as well.
I enabled preferences and It still did not work. It's a rather weird issue since it actually gives me the accX,Y,Z values and it's therefore able to access the accelerometer. In android it works perfectly, but it does not respond in iOS 13+ at all.
That's odd. Are you using 1.0.0 version of the library? If you can try and get a inspector running in desktop Safari connected to the mobile Safari and see if it gives any error or something. I don't have the capacity to test this out fully myself so if you can help debug this that would be very helpful! Thanks.
I'll try and get back to you! Sorry, but i'm dealing with this within a project so I've got a rather big amount of issues to get past me so I'll do this as soon as i can.
Hi! I manage to check it. No error is displayed. Everything's works fine except for the deviceShaken() method in iOS 13+. There are ofCourse some workarounds, but they are pretty complicated (in my case I recurred to some DNN stuff...). Sorry I could not help more.
Thanks.
Most appropriate sub-area of p5.js?
Details about the bug:
Here's my code.
deviceEventNotFired.docx
Oddly enough this one actually works on my phone https://editor.p5js.org/kan352/sketches/HJbxxRwWg