device.watchDeviceOrientation
watchDeviceOrientation() → {boolean}
Enable monitor of the device orientation to detect the current orientation of the device as compared to the Earth coordinate frame. (one some device a first user gesture will be required before calling this function)
// try to enable device orientation event on user gesture
me.input.registerPointerEvent("pointerleave", me.game.viewport, function() {
if (me.device.watchDeviceOrientation() === true) {
// Success
me.input.releasePointerEvent("pointerleave", me.game.viewport);
} else {
// ... fail at enabling the device orientation event
}
});
Type | Description |
---|
Type | Description |
---|---|
boolean |
false if not supported or permission not granted by the user |