I create an application with different layouts for mobile devices hold in portrait or landscape mode. At startup I use GetOrientation(). With broadcasting all works well. But exporting as an Android application GetOrientation() gives always 1 for some time after startup even if the device is hold in landscape orientation. You can test this with this script:
// Project: orientation
// Created: 2016-08-07
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "orientation" )
SetWindowSize( 1024, 768, 0 )
// set display properties
SetVirtualResolution( 1024, 768 )
SetOrientationAllowed( 1, 1, 1, 1 )
orient=getOrientation()
i=0
do
if (GetOrientation()=1)
inc i
endIf
Print("start orientation " +str(orient ))
Print("frames "+str(i))
print("now "+str(GetOrientation()))
Sync()
loop
Broadcasting, I get for a device in landscape orientation
start orientation 3
frames 0
new 3
Thus GetOrientation() gives the correct result and an app would show the layout for landscape mode.
Exporting as a Android app and running it I get:
start orientation 1
frames 47
now 3
Thus GetOrientation() WRONGLY returns at startup that the device is in portrait orientation. The app then uses the wrong layout. Thus it cannot be used if the device is in landscape orientation as it is often the case for larger tablets.
This is a SERIOUS BUG and breaks my work.
Can anyone help me?
Thanks for your attention.
Sincerely yours
Peter Stampfli