Face Up orientation bug

I’m fairly certain this is a bug – but if anyone has any advice on how to correct for this programmatically it would be much appreciated.

The problem is this:

In my build.settings file I have 4 allowable orientations:

settings =
{
orientation =
{
default = “portrait”,
supported =
{
“landscapeLeft”, “landscapeRight”, “portrait”, “portraitUpsideDown”
},
},
}

But when I put my iPad flat on a table (“Face Up” orientation) the orientation switches to a portrait orientation, cropped into a landscape perspective.

The orientation shouldn’t change at all when going into “Face Up” position because “Face Up” is not supported in the build.settings file. And it certainly shouldn’t be giving me this strange portrait ratio displayed (bottom cropped ) onto a landscape orientation.

Is there a way to specifically add an “unsupported” position to the build-settings file? Or some other way to get it to *not* adjust for “face up” orientation?

[import]uid: 40285 topic_id: 9792 reply_id: 309792[/import]

chk out this with ur current settings

[lua]module(…, package.seeall)

function new()

local localGroup = display.newGroup()

if myMode == nil then
if system.orientation == “faceUp” or system.orientation == “faceDown” then
myMode = “portrait”
print(“force for the portrait”)
elseif system.orientation == “portrait” or system.orientation == “portraitUpsideDown” or system.orientation == “landscapeLeft” or system.orientation == “landscapeRight” then
myMode = system.orientation
end
end
print(myMode …“system”)

local function onOrientationChange( event )
– change text to reflect current orientation
if event.type == “faceUp” or event.type == “faceDown” then

else
myMode = event.type
print(myMode …“orientation”)
end

if myMode == “portrait” or myMode == “portraitUpsideDown” then
local img = display.newImage(“bg_portrait.png”)
localGroup:insert(img)
elseif myMode == “landscapeLeft” or myMode == “landscapeRight” then
local img = display.newImage(“bg_landscape.png”)
localGroup:insert(img)
end
myText:toFront()
end

Runtime:addEventListener( “orientation”, onOrientationChange )

if myMode == “portrait” or myMode == “portraitUpsideDown” then
local img = display.newImage(“bg_portrait.png”)
localGroup:insert(img)
else
local img = display.newImage(“bg_landscape.png”)
localGroup:insert(img)
end

myText = display.newText(“first”,160,240,native.systemFont,48)
myText:setTextColor(0,0,0)
myText:toFront()
local function changePage()
myText:removeSelf()
Runtime:removeEventListener( “orientation”, onOrientationChange )
director:changeScene( “second” )
end
myText:addEventListener(“tap”,changePage)

–director:changeScene( “second” )
return localGroup
end[/lua] [import]uid: 12482 topic_id: 9792 reply_id: 35673[/import]

… I think the problem may be my confusion about the purpose of the build.settings file. I was thinking it only permitted the events listed in build.settings.

[import]uid: 40285 topic_id: 9792 reply_id: 35672[/import]

Thanks for the response Hgvyas. That’s pretty much what I’m doing now.

I was thinking that listing 4 allowable orientations in build.settings would prevent any orientation events outside of those listed.

But I guess that’s not the case.

[import]uid: 40285 topic_id: 9792 reply_id: 35676[/import]

have you installed this code in device this code can handle faceUp and faceDown mode [import]uid: 12482 topic_id: 9792 reply_id: 35677[/import]

Hgvyas,

Yes. Thanks. I’ve got it working now. Originally I misunderstood the point of the build.settings file. I thought build.settings prevented orientation events not specifically listed. [import]uid: 40285 topic_id: 9792 reply_id: 35923[/import]

So it seems that i came across this very same issue with my newest App for Iphone. At first i thought my app was crashing until i realized it only had a black screen when i would lay it down flat and load new Lua/scenes. I found a very easy fix that works like a charm for what i am doing.

For Landscape

if display.contentHeight == 320 or display.contentHeight == 640 then

For Portrait

if display.contentHeight == 480 or display.contentHeight == 960 then

simple but it does the job [import]uid: 39391 topic_id: 9792 reply_id: 51792[/import]

adamdenterkin, almost 18 months after posting that reply, you have just blown my mind!
I’ve been using much more complicated methods to try and overcome bugs that I get if the app starts in a faceUp + faceDown orientation.
I can’t believe I didn’t think to do it our way, but it worked perfectly. Thanks! [import]uid: 84115 topic_id: 9792 reply_id: 138484[/import]

adamdenterkin, almost 18 months after posting that reply, you have just blown my mind!
I’ve been using much more complicated methods to try and overcome bugs that I get if the app starts in a faceUp + faceDown orientation.
I can’t believe I didn’t think to do it our way, but it worked perfectly. Thanks! [import]uid: 84115 topic_id: 9792 reply_id: 138484[/import]