Detecting device orientation? (SOLVED)

I’ve been skimming the api documentation and forums for a definitive answer to this question, but I cant seem to find any way to detect if the device is in landscape or portrait mode.

Is there a message that gets broadcast when the device switches orientation or have I perhaps missed some api function that facilitates this?

Thanks in advance.
B.

Yes, you will get a window_resized message when orientation (or window size) changes.

6 Likes

Oh! Thank you Björn! I didn’t even think that you could cleverly resolve this information using the window dimensions on a mobile device, what a clever use of a consistent API for both mobile and desktop.

1 Like