Hi i need help to implement touch->compare orientation on iphone, it works well on android but i think for iphone device it will need to ask permission for accelerometer to work.
i found this piece of js code to ask permission on iphone, and it work, my question is, where i need to put this on my construct 3 game?
function getAccel(){
DeviceMotionEvent.requestPermission().then(response => {
if (response == 'granted') {
// Add a listener to get smartphone orientation
// in the alpha-beta-gamma axes (units in degrees)
window.addEventListener('deviceorientation',(event) => {
...
});
}
});
}
the complete code is in here
and the working sample for that code (not construct 3 exported game) is here
thanks