Sketch orientation Android

Hi I’m looking for a solution to a small problem. I have already searched online, to find out how to lock my rotation, and came across the orientation reference.

https://android.processing.org/reference/environment/orientation.html

Now the only issue that I have is that this locks the landscape version permanently meaning that if I rotate the phone 180 degrees so its now in its next landscape orientation the screen is now updside down. Any help much appreciated, thanks.

@paulgoux ===instead of locking the orientation you have to handle it by code

Can you be a bit more specific? I’d be happy to if I can see code examples online, but I cant find anything which allows me to specify the rotation once the app is loaded. Or are you saying that I have to manually rotate my app based on some variable on the phone gyro. Which again happy to do but don’t know where to start.

@paulgoux === in your manifest you precise that you are handling the orientation and of course in the setup you dont lock it; then you have an handler in the code for “orientationChanges” and here you precise what is happening when the phone is rotated for 90° or 180° or… ```based as you say on what the sensor returns through its OrientationEventListener.

more details here= https://developer.android.com/reference/android/view/OrientationEventListener

1 Like

Thank you ill take a look later.