Rotation on Android
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 135
- Joined: Thu Sep 13, 2012 10:25 pm
Rotation on Android
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
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
Re: Rotation on Android
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
I have to use "the machine" to lock it in one mode if it's a Fire.
Work arounds.. all over the place.
Simon
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

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!
-
- Posts: 135
- Joined: Thu Sep 13, 2012 10:25 pm
Re: Rotation on Android
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
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
Re: Rotation on Android
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.
Maybe that will give you a clue as to what the device thinks.
Simon
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
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 135
- Joined: Thu Sep 13, 2012 10:25 pm
Re: Rotation on Android
Fantastic. Thanks for those tips. I've got to head to bed - but I'll check it out in the morning...
Joel
Joel
-
- Posts: 135
- Joined: Thu Sep 13, 2012 10:25 pm
Re: Rotation on Android
Hi all -
I believe there may be a bug with rotation on Android devices. I've attached a sample. I'm using LiveCode 7.0
if I have the following code in a preOpenCard script of one card:
and then this code in the preOpenCard script of another:
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
I believe there may be a bug with rotation on Android devices. I've attached a sample. 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
Code: Select all
if the environment is "mobile" then
mobileSetAllowedOrientations "landscape left"
end if
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
Re: Rotation on Android
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
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!
Re: Rotation on Android
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.
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!
-
- Posts: 135
- Joined: Thu Sep 13, 2012 10:25 pm
Re: Rotation on Android
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
And thanks, Andy. I appreciate you pointing this out to me. I'll definitely check it out.
Joel
Re: Rotation on Android
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w