Ubuntu: How to lock ubuntu device orientation in portrait or landscape from user input?



Question:

I am working on a reader app to be used on Ubuntu-Touch. When reading books from the app it would be a helpful feature to lock the orientation in either portrait or landscape. This would be useful when reading in bed sideways.

I've tried to use automaticOrientation = false or true, however, the SDK currently locks the orientation in portrait when set to false.

Is there a way to lock the orientation of the device screen in one or the other and have it stay locked?

Update:

Newer releases of Ubuntu for Phone have a global option to lock orientation, however, I would still like to do this at the app level.

I am still looking for a way to do this.


Solution:1

Unfortunately there's no way yet to set a certain orientation programatically. You can however lock the orientation for your app on a certain one (portrait or landscape) in your app's desktop file. See the following link: https://wiki.ubuntu.com/Unity8/FullShellRotation. The feature has been released some time ago, and perhaps you already use that.


Solution:2

Is this still a problem for you? Perhaps exposing the system level functionality through your app's UI might be the best way to go. I suspect locking at the app level would be considered a bug by the system developers so it's not offered.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »