orientation on Android device

I am using daily build 691 and have noticed that orientation doesn’t seem to work on an Android device.

I am having problems with orientation on Android devices, but no problem on simulator or iPhone hardware.

When I run my app (or the sample Native Orientation app) on an Android device, changing the orientation of the device doesn’t seem to change the system.orientation value. It is triggering an orientation event though.

So, what seems to happen is that the screen does rotate, but my code is unable to deal with the rotation by repositioning items to account for the new orientation, so everything’s displayed wrong.

The build.settings file has all the orientations set as available, as per the sample code.

I understand that Android has more limited support for orientation changes than iOS, but does ‘auto-rotation is not currently supported on Android’ mean that, for Android, I can’t allow the user to rotate their phone and should only have one allowable orientation in my build.settings file? If so can that feature be supported in the future?

Thanks [import]uid: 93610 topic_id: 18211 reply_id: 318211[/import]

There is a known bug where Corona does not update the “system.orientation” property on Android. However, you can work around this bug by handling the orientation event, which does provide the correct current orientation setting. Please see sample apps “Graphics\Fishies” or “Interface\NativeDisplayObjects” included with the Corona SDK for an example on how to handle orientation events. [import]uid: 32256 topic_id: 18211 reply_id: 69601[/import]

Thanks for that! [import]uid: 93610 topic_id: 18211 reply_id: 69605[/import]

Is this fixed in one of the updated daily builds? [import]uid: 4883 topic_id: 18211 reply_id: 95955[/import]

Yes. This has been fixed since the release version, build #704. [import]uid: 32256 topic_id: 18211 reply_id: 96351[/import]

Am experiencing the same issue as harry with Corona build 750.
Am using Kwiksher Photoshop CS5 plug-in to develop my App,My coding experience is limited and I am unable to implement the work around by manual coding. Thanks in Advance for any help.
[import]uid: 99743 topic_id: 18211 reply_id: 96390[/import]

I’ve confirmed that the orientation handling on Android is working correctly for me. Have a look at sample apps “Graphics/Fishies” and “Interface/Orientation” for an example on how to set up the Lua listener for receiving orientation changes. Perhaps it will help you out. [import]uid: 32256 topic_id: 18211 reply_id: 96416[/import]

Joshua,

ms issue (as he talked to me) is the fact his project has only portrait mode (landscape not allowed - so, no need to control orientation here, besides the build.settings file). What is happening is, in Android devices, when turning the device, it seems to “want” to reposition/re-scale the current portrait view.

am i right ms?

Alex [import]uid: 4883 topic_id: 18211 reply_id: 96434[/import]

@Alex

Yes, that is correct and that is the dilemma i currently face.
[import]uid: 99743 topic_id: 18211 reply_id: 96438[/import]

I’m not sure if I understand what the issue is. Are you saying that the display is changing orientation when you have locked the orientation in the build.settings file? If that’s the case, then it sounds like you have a typo in your build.settings file. Can you paste the contents of your build.settings file here in the forum please? I can then take a quick look. Make sure to put [lua][lua][/lua][/lua] tags around your settings so that it will be readable. Thanks! [import]uid: 32256 topic_id: 18211 reply_id: 96447[/import]

@Joshua
Yes,that’s correct.That’s the problem.
I assume i have locked the orientation.
I have chosen Portrait throughout the (Kwiksher)build.
I have copied the build file as below.
Thanks !
/////////////////

– build.settings
settings =
{
androidPermissions =
{
“android.permission.RECORD_AUDIO”,
“android.permission.WRITE_EXTERNAL_STORAGE”,
},
orientation =
{
default = “Portrait”,
supported = { “portrait”, “portraitUpsideDown” }
},

iphone =
{
plist=
{
UIApplicationExitsOnSuspend = false,
UIHiddenStatusBar=“YES”,
CFBundleIconFile=“Icon.png”,
CFBundleIconFiles = {
“Icon.png”,
“Icon@2x.png”,
“Icon-72.png”,
“Icon-72@2x.png”,
},
},
},
} [import]uid: 99743 topic_id: 18211 reply_id: 96459[/import]

Okay. There is a problem in your build.settings file. You need to change…
[lua] default = “Portrait”,[/lua]
…to the following…
[lua] default = “portrait”,[/lua]

The orientation setting is case sensitive. It needs to be lower case. [import]uid: 32256 topic_id: 18211 reply_id: 96690[/import]

@Joshua

Your solution fixed it. Fantastic !
Can’t thank you enough.
I owe you a beer.
Many Thanks :slight_smile: [import]uid: 99743 topic_id: 18211 reply_id: 96700[/import]

Fix in kwik coming in the next release.
Thank Joshua! [import]uid: 4883 topic_id: 18211 reply_id: 96707[/import]

I’m glad it’s working for you guys. Happy to help! [import]uid: 32256 topic_id: 18211 reply_id: 96792[/import]