Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Can Corona fix Android orientation change bug? Fails to obey system preferences
Started by corona273 Sep 24 2015 11:11 AM

26 replies to this topic
android orientation orientation event resize event screen system preferences
[TOPIC CONTROLS]
Page 1 of 2 1 2
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

corona273

[GLOBAL: userInfoPane.html]
corona273
  • Contributor

  • 482 posts
  • Enterprise

Folks:

 

Android has a system preference (Auto-rotate) that allows people to lock their screen orientation in landscape or portrait mode. Here's a news article about it: http://www.techrepublic.com/article/pro-tip-lock-your-android-tablet-screen-in-either-landscape-or-portrait-mode/

 

Unfortunately Corona SDK-built apps fail to obey the system preference. The orientation/resize events fire and the app fails to comply with user expectations. This is an SDK bug that leads to pissed off users and a poor experience.

 

Can y'all fix this soonest? Thanks!

 



[TOPIC: post.html]
#2

Alex@Panc

[GLOBAL: userInfoPane.html]
Alex@Panc
  • Corona Geek

  • 1,733 posts
  • Corona SDK

@corona273 can you post your build.settings? Within, you can specify the orientations your app can support. If you don't list a particular orientation, then your app won't rotate to that orientation.

 

As a test, I just locked my device to portrait orientation, then opened an app I built in Corona SDK which only supports landscape orientation, and it did rotate to landscape, and would not allow a rotation to portrait. Below are the supported orientations for this app, as listed in my build.settings file:

	orientation =
	{
            default = "landscapeRight",
       		supported =
       		{
               	"landscapeRight",
       		},
       },

I wouldn't want my app to force itself into portrait, even if the user has locked their phone to that orientation. Am I misunderstanding your issue? 

 

UPDATE: I apologize, I think I did in fact misunderstand, in that you are saying that, if your Corona app lists all orientations in build.settings, and the device has been locked to portrait, the Corona app will still allow rotation to landscape. Is that accurate?


Edited by Alex@Panc, 24 September 2015 - 11:27 AM.


[TOPIC: post.html]
#3

corona273

[GLOBAL: userInfoPane.html]
corona273
  • Contributor

  • 482 posts
  • Enterprise

Thanks, Alex. I may not be explaining this properly. You're talking about apps that support a single orientation; I'm talking about apps that support multiple orientations. In my case the app supports four orientations -- here's an excerpt from build.settings:

supported = { "landscapeLeft", "landscapeRight", "portrait", "portraitUpsideDown", },

If an Android user disables auto-rotate, they expect apps to honor only that orientation and not rotate. Unfortunately Corona SDK-built apps with the build.settings line above will rotate anyway (even when the user has set the system preferences accordingly). This should not happen.

 

The problem is that the Corona SDK runtime is not reading the system preference. This is a trivial fix but it's something that Corona needs to do.



[TOPIC: post.html]
#4

corona273

[GLOBAL: userInfoPane.html]
corona273
  • Contributor

  • 482 posts
  • Enterprise

PS: The bug is Case 42969.



[TOPIC: post.html]
#5

corona273

[GLOBAL: userInfoPane.html]
corona273
  • Contributor

  • 482 posts
  • Enterprise

Alex wrote:

 

if your Corona app lists all orientations in build.settings, and the device has been locked to portrait, the Corona app will still allow rotation to landscape

 

 

 

Yep, that's the bug!

 

You described it more succinctly than I was able to. :)



[TOPIC: post.html]
#6

corona273

[GLOBAL: userInfoPane.html]
corona273
  • Contributor

  • 482 posts
  • Enterprise

Just got this bug report from a user (yes, the app is live in the Play Store):

 

Why is the app ignoring my screen rotation settings?? I have it set to portrait mode and no rotation, but still goes to landscape when I turn it sideways. Very annoying when trying to use it while in bed for example. 
 

 

 

It sure would be nice to have this fixed in the next few days...


[TOPIC: post.html]
#7

corona273

[GLOBAL: userInfoPane.html]
corona273
  • Contributor

  • 482 posts
  • Enterprise

[TOPIC: post.html]
#8

Alex@Panc

[GLOBAL: userInfoPane.html]
Alex@Panc
  • Corona Geek

  • 1,733 posts
  • Corona SDK

@corona273 I realize this would be an ugly hack and could mean additional development time for a feature that is technically a Corona issue, but perhaps you could include do the following:

 

1) Only set orientation to support "portrait".

2) Have a setting for orientation settings within the app itself.

2a) User can set the app to either a. rotate as normal or b. stay locked to one orientation.

3) Create a listener that detects orientation changes, and use it to manually rotate the UI objects to respect the orientation. Examples of this process are described here and here.

 

Again, this is a fair amount of work (assuming you don't already have a process for the above) for something that technically should be picked up by Corona's Runtime. However, if you have the bandwidth to address this, it might work well in your favor. Again, just a suggestion.

 

I tried out your app and I'm incredibly impressed. Everything feels fantastic and I've already given a 5-star review. The polish shows, and I think it's clear that input from your graphic designer made the app look amazing. Good luck with everything!


Edited by Alex@Panc, 25 September 2015 - 07:31 AM.


[TOPIC: post.html]
#9

corona273

[GLOBAL: userInfoPane.html]
corona273
  • Contributor

  • 482 posts
  • Enterprise

Alex: Thanks! But I don't think I understand. If I have only one orientation--let's say portrait--defined in build.settings, and the user rotates the device, the listener that would normally detect orientation changes does not fire (I tested this yesterday in the simulator).

 

So I don't know how to do what you described. :(



[TOPIC: post.html]
#10

Alex@Panc

[GLOBAL: userInfoPane.html]
Alex@Panc
  • Corona Geek

  • 1,733 posts
  • Corona SDK

I did some proof-of-concept testing on this a while ago, but if you tested it more recently and found it not working, then I'm more inclined to go with your research. Hopefully Corona can get this fix in quickly!



[TOPIC: post.html]
#11

corona273

[GLOBAL: userInfoPane.html]
corona273
  • Contributor

  • 482 posts
  • Enterprise

It's been a while since I posted this bug last Thursday... Anyone? Rob?



[TOPIC: post.html]
#12

corona273

[GLOBAL: userInfoPane.html]
corona273
  • Contributor

  • 482 posts
  • Enterprise

It's now been over a week and no response from anyone at Corona? This is not exactly encouraging. :(



[TOPIC: post.html]
#13

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,393 posts
  • Enterprise

If I read the notes right, the Engineers have looked into this. I'm trying to translate what they said so bear with me. It appears that the preferences are honored for native apps that depend on the OS to manage orientation. Apps that programmatically control orientation (which we do because we pull the info out of build.settings and set the orientation ourselves).

 

It's assigned to an engineer.  Engineering is planning to get back to Android 6 support after we get this public release out. This bug will be dug deeper into as part of our Android 6 support where we will learn more about our ability to address it.

 

Rob



[TOPIC: post.html]
#14

corona273

[GLOBAL: userInfoPane.html]
corona273
  • Contributor

  • 482 posts
  • Enterprise

Thanks, Rob! I appreciate you taking time out of your Saturday evening (and late on a Saturday evening, at that) to reply to pesky screen rotation questions.
 

To clarify one point: This has nothing to do with Android 6 or Android M. The screen rotation lock, which is not supported in Corona SDK, has been in Android for at least 1.5 years. (The article I linked to above discussing it was 1.5 years old.)

 

It's growing late here on the left coast and I'm getting a bit tired and may not be thinking clearly, but it strikes me that one way to fix this Corona SDK bug would be for you to add a respectScreenRotationLock boolean in build.settings.

 

Setting respectScreenRotationLock to false preserves current behavior--as would setting respectScreenRotationLock to true with the system-wide lock setting disabled. What would change is if respectScreenRotationLock is true and the system-wide lock setting is enabled. Then the Corona display canvas would not be resized and rotation/resize events would not be sent.

 

That seems to be an easy way to fix this bug that would [a] preserve the behavior of existing apps, [b] require no source code changes, and [c] require developers to alter only one line.

 

I'm happy to talk to your engineers directly if you like. :)



[TOPIC: post.html]
#15

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,393 posts
  • Enterprise

You're right, it has nothing to do with Android 6. But it's going to get looked at when we get back to adding  Android 6 support. Android 6 changes how permissions are done which means we will be working with build.settings (speculation).

 

Sure adding some flag in build.settings might be the User interface to it, but behind the scenes we have to make it work. As I said, Corona SDK managed rotations programmatically and apps, Corona or not, don't usually use that setting (if I translated the Engineers correctly). At a minimum, we are going to have to figure out how to read that setting. Figure out how to make it work on all the versions of Android we support. So I'm not promising anything. Perhaps its easy, perhaps its very hard.

 

Rob



[TOPIC: post.html]
#16

corona273

[GLOBAL: userInfoPane.html]
corona273
  • Contributor

  • 482 posts
  • Enterprise

Rob: Thanks for your reply. I think this may actually be a one-line change on the part of Corona.

 

Corona is probably using the Android "fullSensor" orientation, which allows for the four normal screen orientations. If you change that to "user" it will act the same as fullSensor except when the system-wide orientation preference is set. Documentation is here: http://developer.android.com/guide/topics/manifest/activity-element.html#screen

 

I may be wrong, of course, but it would really be a shame if this bug sat in a queue for an indefinite time -- when it may merely require your colleague to type about 10 keystrokes to fix... :(

 

Meanwhile, I am going to have to release a build disabling all orientation change and landscape support on all Android devices because our users hate, hate, hate this Corona SDK bug and are savaging our Play Store ratings as a result. :(



[TOPIC: post.html]
#17

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,393 posts
  • Enterprise

I can only go on what engineering told me. This does not feel like low hanging fruit.



[TOPIC: post.html]
#18

corona273

[GLOBAL: userInfoPane.html]
corona273
  • Contributor

  • 482 posts
  • Enterprise

Rob: Because of this Corona SDK bug, we've been forced to release a new version of our app on Android that disables all rotation, even for tablets (Android tablets are now locked into portrait mode, not the more useful landscape mode). You can see the release notes here: https://play.google.com/store/apps/details?id=io.recent.personal.news

 

It's been a few weeks--it sure would be nice for Corona to fix this so we can support the same minimum functionality on Android as other apps on that platform. :(



[TOPIC: post.html]
#19

corona273

[GLOBAL: userInfoPane.html]
corona273
  • Contributor

  • 482 posts
  • Enterprise

And now one of our users just wrote to us: "I loved your recent news app until the last update. I can not change to landscape and I will not use it in portrait. Is this a bug or did you lock portrait on purpose?"

 

This Corona SDK bug is damaging our app store rating, is unnecessarily annoying our users, and is impossible for us to fix. Corona staff need to fix this. We cannot. It makes both our app and Corona SDK look bad.

 

It's been 2.5 weeks -- do you have an update on when this Corona SDK bug will be fixed? 



[TOPIC: post.html]
#20

bjsorrentino

[GLOBAL: userInfoPane.html]
bjsorrentino
  • Veteran

  • 8,506 posts
  • Corona SDK

Hi @corona273,

We have a potential fix for this which should be tested in the next couple days. I'll keep you posted...

 

Brent



[TOPIC: post.html]
#21

corona273

[GLOBAL: userInfoPane.html]
corona273
  • Contributor

  • 482 posts
  • Enterprise

Brent: Yay! I will email our users back and tell them a fix may be coming soon. (If I sound frustrated, it's because I'm channeling what our users have been telling us...)

 

Thanks again.



[TOPIC: post.html]
#22

corona273

[GLOBAL: userInfoPane.html]
corona273
  • Contributor

  • 482 posts
  • Enterprise

Brent: 'evening! It's been another week and this bug has not been fixed in the latest daily builds (as far as I can tell), so I thought I'd check in. Do you have an updated estimate on when this SDK bug will be fixed?

 

Thanks!



[TOPIC: post.html]
#23

bjsorrentino

[GLOBAL: userInfoPane.html]
bjsorrentino
  • Veteran

  • 8,506 posts
  • Corona SDK

Hi @corona273,

The engineers are continuing work on this (I'm monitoring their progress, ha ha). This issue has turned out to be anything but low-hanging fruit, unfortunately... there should be a resolution soon though.

 

Brent



[TOPIC: post.html]
#24

corona273

[GLOBAL: userInfoPane.html]
corona273
  • Contributor

  • 482 posts
  • Enterprise

Thanks, Brent, for the update. Please let us know when you have more to share!
 



[TOPIC: post.html]
#25

Ajay McCaleb

[GLOBAL: userInfoPane.html]
Ajay McCaleb
  • Contributor

  • 209 posts
  • Corona Staff

After lots of headache, this issue is finally resolved.

 

As Brent said, this turned out to be far from low-hanging fruit. One reason for this is that we needed custom code to handle the auto-rotate setting correctly on API Levels 10-17 for portrait or landscape only apps.

 

Another reason is that different vendors also have their own ways of handling orientation behaviors, so sifting through these different behaviors and all the edge cases took a significant amount of time to get right.

 

Anyway, the fix should come in build 2745.




[topic_controls]
Page 1 of 2 1 2
 
[/topic_controls]