Android Question Default landscape orientation

Raywingit

Member
Licensed User
Longtime User
I developed an App which is now 8 years old, and it mainly uses portrait mode but has a landscape layout that shows some unique stuff. This has worked fine on about 8 android phones, 2 tablets. It uses the "get layout values" to determine the orientation which layout to load and I've had no issues up till now.
I now have an android watch with an oblong screen which defaults to landscape mode for it's display, although an app with portrait only runs in portrait OK. When I load the App in question, it runs in landscape only. It does not switch when I rotate the watch, and when I tried hacking the code to make it start in Portrait with the landscape code commented out, it loaded in portrait for a second then rotated the screen and went blank. So there's something in the device forcing it to revert to landscape, is my thinking.
The watch does know it's orientation because one of the Apps features is to display an arrow pointing to the Sun when horizontal and vertical. I am next going to try and use the orientation instead of layout values to load.
 

MicroDrie

Well-Known Member
Licensed User
Hm, be aware that even with the current Netflix version, for example, the app only wants to start in protrait mode. The problem started after a certain Android update. I would therefore only test portrait / landscape in a test program that is as bare as possible and, if it works, add the necessary libraries one by one to see whether portrait / landscape continues to work.
 
Upvote 0

Raywingit

Member
Licensed User
Longtime User
I checked the accelerometer sensor on the watch, it has X = 10 when I hold it in portrait (narrow) position, and Y =10 when in landscape (wide).
This is the opposite to what I see on my phone. So the problem appears to be the watch treats USUAL orientation (which is wide-screen) as Portrait,
and SIDEWAYS orientation (which is narrow) as Landscape. The concept of portrait and landscape have been lost in translation.
My app uses the orientation sensors when it's calculating screen updates, so I just need to un-knit the X-Y cross-overs (I hope).
 
Upvote 0

Raywingit

Member
Licensed User
Longtime User
I managed to get the portrait mode working by adding: ph.SetScreenOrientation(1) at the start of Activity Create.
However, I dug into the sensors and found the device does not support "Orientation" which explains why it didn't rotate the screen.
I'm thinking my rotate command can be jury-rigged using the Accelerometer or by adding a button.
 
Upvote 0

Raywingit

Member
Licensed User
Longtime User
The problem is best characterized as "no orientation sensor". This means there's no kick to make it rotate, and no way to find out which way is up when it restarts.
Fixed it by checking the accelerometer and putting a flag on the clip-board which it finds during activity create. Maybe there's a better way?
 
Upvote 0
Top