Android Question How is the phone held?

grafsoft

Well-Known Member
Licensed User
Longtime User
I need to set the screeen orientation with phone.setscreenorientation

But I want to know how the phone is held, i.e. what the screen orientation (portrait, landscepe ...) would be if I did not set the screen orientation.

I hope it is understandable what I am writing.
 

ac9ts

Active Member
Licensed User
Longtime User
Unless you have a square screen:

B4X:
If 100%x > 100%y then
   ' In landscape mode
else
   ' In portrait mode
end if
 
Upvote 0

ac9ts

Active Member
Licensed User
Longtime User
Maybe I misunderstood your question. I read it as you wanted to determine the screen orientation first (while the screen is still free to rotate) and then you would freeze it using SetScreenOrientation. The code I left will tell you the orientation; frozen or free to rotate.
 
Upvote 0

grafsoft

Well-Known Member
Licensed User
Longtime User
Thanks, both of you. But I think there is no solution. Either I set the orientation, then it is fixed no matter how the device is held. Or I don't, then I can get the orientation.
 
Upvote 0

grafsoft

Well-Known Member
Licensed User
Longtime User
Thank you, that would work! But my security app warns me that this app could be harmful and should be deinstalled. So I will leave the problem for now.
 
Upvote 0
Top