Corona orientation depending on Device Type (ANDROID)

Hello,

I would like to set my app’s supported orientation depending on device type on android. To specify: sensorLandscape orientation on Tablets and sensorPortrait on smartphones (assuming that the tablet is a device with screen diagonal more that 6 inches).

I tried to do this by checking the device’s screen size in Corona on start of application, before any objects rendering. Then I run native function: coronaActivity.setRequestedOrientation() to set SCREEN_ORIENTATION_SENSOR_LANDSCAPE or SCREEN_ORIENTATION_SENSOR_PORTRAIT. The problem is: after changing screen orientation from landscape to portrait or inversely, the display.contentWidth and -height are unchanged. It seems to CoronaActivity is rotating, but “corona view” inside this activity does not reload screen dimensions. I could deal with it by force exchange contentWidth and contentHeight, but this solution is a little silly.

I have also discovered that if I set screenOrientation of CoronaActivity inside AndroidManifest.xml as “landscape” (for example) and set “portrait” as default orientation in Corona’s build.setting, then app will run in landscape mode. I wonder what orientation should be set to CoronaActivity in AndroidManifest to let build.setting orientation work corretctly, irrespective of orientation of CoronaActivity.

 

Could somone from CoronaLabs help and clarify how it is exactly working? What is dependence between the screenOrientation of CoronaActivity and the orientation set in build.settings? Is it also possible to set supported orientations before starting CoronaActivity, but not in build.settings (because inside build setting you cannot use conditional statements to decide what orientation should be supported)?