Rotation on Android

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
joel.epsteinBUS31vi
Posts: 135
Joined: Thu Sep 13, 2012 10:25 pm

Rotation on Android

Post by joel.epsteinBUS31vi » Tue Nov 04, 2014 1:50 am

Hi all -

I'm fairly new to Android development and could use a quick pointer.

I'm building an app in which almost all the cards need to be portrait, but a couple need to be in landscape.
In iOS, in my "on OpenCard" script, I put either mobileSetAllowedOrientations "portrait" or mobileSetAllowedOrientations "landscape left"
This works great, and the orientation of the app flips just like I want when I navigate from screen to screen.

However, under Android, things aren't working like that at all.
In fact, I'm actually quite puzzled by how it's working.
Seems like if I rotate the device right when I'm on a portrait orientation screen, the app will rotate to the right and shrink to fit the screen. But then it seems to be locked in that orientation until I force quit the app.
And it seems as if the app does nothing whenever I rotate the screen in any direction whenever I'm on a screen that has the "landscape left" orientation set.

I'm sure that I'm probably missing something fairly basic, but I'm not sure what it is.

I'd appreciate any advice you might be able to provide.

Thanks so much.

Joel

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Rotation on Android

Post by Simon » Tue Nov 04, 2014 4:16 am

Hi Joel,
Do you use accelerated rendering? Try turning it off and see if that helps.
other
Some Android devices don't follow the rules, my Kindle Fire reverses landscape right/left :x
I have to use "the machine" to lock it in one mode if it's a Fire.

Work arounds.. all over the place.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

joel.epsteinBUS31vi
Posts: 135
Joined: Thu Sep 13, 2012 10:25 pm

Re: Rotation on Android

Post by joel.epsteinBUS31vi » Tue Nov 04, 2014 4:22 am

Thanks, again, Simon.

I'm not using accelerated rendering.

What's confusing me is that on the Android (Galaxy 5 & Nexus 7) when the
mobileSetAllowedOrientations "portrait"
is set for a card, and I rotate the device into a landscape orientation, the app does indeed rotate - when, in fact, it shouldn't. And what's worse, it seems to get stuck that way.

Surely I'm doing something wrong here. Can't quite figure it out though.

Any ideas?

Joel

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Rotation on Android

Post by Simon » Tue Nov 04, 2014 4:37 am

OK...
Try moving ...AllowedOrientations to preOpenCard
If not there then on closeCard from the previous card.
Or maybe a combo of both.

Yes, I am just guessing, I do not know specifically why it isn't working.

Code: Select all

on orientationChanged
   answer mobileDeviceOrientation()
end orientationChanged
Maybe that will give you a clue as to what the device thinks.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

joel.epsteinBUS31vi
Posts: 135
Joined: Thu Sep 13, 2012 10:25 pm

Re: Rotation on Android

Post by joel.epsteinBUS31vi » Tue Nov 04, 2014 4:51 am

Fantastic. Thanks for those tips. I've got to head to bed - but I'll check it out in the morning...

Joel

joel.epsteinBUS31vi
Posts: 135
Joined: Thu Sep 13, 2012 10:25 pm

Re: Rotation on Android

Post by joel.epsteinBUS31vi » Tue Nov 04, 2014 4:42 pm

Hi all -

I believe there may be a bug with rotation on Android devices. I've attached a sample.
RotTest.livecode.zip
(63.4 KiB) Downloaded 297 times
I'm using LiveCode 7.0

if I have the following code in a preOpenCard script of one card:

Code: Select all

   if the environment is "mobile" then
      mobileSetAllowedOrientations "portrait"
   end if
and then this code in the preOpenCard script of another:

Code: Select all

   if the environment is "mobile" then
      mobileSetAllowedOrientations "landscape left"
   end if
on iOS devices, the screen will appropriately rotate as I navigate between the two screens.

However, on Android, I do not see this behavior.

Furthermore, on Android, when I have that code and I'm on the initial card, I actually can rotate the device and the orientation of the card will change (which it should not). Even more strange is the fact that if I do not include that script, and rotate the device, then the orientation of the card does not change.

Perhaps I'm missing something, but it seems like a bug to me.

Can anyone confirm? And if this is indeed a bug, can you please remind me how to submit?

Thanks so much.

Joel

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Rotation on Android

Post by Simon » Tue Nov 04, 2014 9:35 pm

Hi Joel,
Yep, tested on my Kindle and it does as you say, but... only when I changed cd 2 to landscape right. Landscape left nothing happened and it all just stayed in portrait mode.

It works in 6.6.1.

Report it as a bug
http://quality.runrev.com/

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

AndyP
Posts: 634
Joined: Wed Aug 27, 2008 12:57 pm
Contact:

Re: Rotation on Android

Post by AndyP » Tue Nov 04, 2014 9:55 pm

This was reported as a bug in 7

http://quality.runrev.com/show_bug.cgi?id=13780

There is a 7.0.1-rc-1 which according to the release notes has this fixed.
Andy .... LC CLASSIC ROCKS!

joel.epsteinBUS31vi
Posts: 135
Joined: Thu Sep 13, 2012 10:25 pm

Re: Rotation on Android

Post by joel.epsteinBUS31vi » Tue Nov 04, 2014 11:08 pm

Thanks for checking, Simon. I appreciate your ongoing support.

And thanks, Andy. I appreciate you pointing this out to me. I'll definitely check it out.

Joel

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Rotation on Android

Post by MaxV » Mon Dec 01, 2014 4:54 pm

Orientation on Android is an old bug: http://quality.runrev.com/show_bug.cgi?id=11146
:(
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Post Reply