Skip to main content
grosssmutttr
Known Participant
July 13, 2013
Question

Samsung Galaxy Tab Orientation/aspectRatio Bug

  • July 13, 2013
  • 2 replies
  • 1961 views

Hi there,

we developed an App and defined <aspectRation>portrait</portrait> in the descriptor xml.

We also set:

<autoOrients>false</autoOrients>

        <fullScreen>true</fullScreen>

        <visible>true</visible>

        <softKeyboardBehavior>none</softKeyboardBehavior>

The Samsung Galaxy Tab 2 7.0 gt-p3110 with Android 4.2.2 seems to ignore this setting and so the app always crashes.

We tested it with Android 3.7 and 3.8 beta.

Perhaps this is also the issue why the App becomes rejected on Samsung Apps...

http://forums.adobe.com/thread/1212455?tstart=0

Best

omi

This topic has been closed for replies.

2 replies

Known Participant
July 25, 2013

Its been awhile, but if I remember correctly the Galaxy Tab's default orientation is Landscape where as most devices, certainly phones, tend to have their default orientation as Portrait. So my code actually detects Portrait mode as:

var isPortraitView:Boolean;
public function setIsPortraitView():void {
    // Each device, for AIR or for Android, can choose either Landscape mode or Portrait mode as the DEFAULT.
    // This means there is no system property to check for portrait mode, so we'll create our own.
    isPortraitView = (stage.fullScreenWidth < stage.fullScreenHeight);
}

The apps I work with auto orient which won't happen if you set the Aspect ratio to Portrait or Landscape - regardless of how the AutoOrient flag is set. Setting the aspect ratio to auto just removes the line entirely from the app descriptor file.

So my app at start up determines and sets isPortraitView and then checks the stage.orientation property against it like so:

// Interpretes the given orientation against the given aspect ratio
public function getIsPortrait(orientation:String, aspectR:Boolean):Boolean {
     var view:Boolean = false;

     switch (orientation) {
        case StageOrientation.DEFAULT:
        case StageOrientation.UPSIDE_DOWN:
             view = aspectR;
             break;
        case StageOrientation.ROTATED_LEFT:
        case StageOrientation.ROTATED_RIGHT:
             view = !aspectR;
             break;
        case StageOrientation.UNKNOWN:
        default:
             break;
     }

     return view;
}

Later when my app gets orientation change events I use the above method to decode them. Remember though that as the device physically rotates clockwise the orientation events are received counterclockwise - think of it as a bubble on a level.

Also there can be a problem with apps not reporting their capabilities correctly when first starting up. So my code actually takes it one step farther and when first setting isPortraitView I also use it to correctly set internal properties for width and height like so:

// Capabilities reports screen resX and resY based on the mode the app starts in
if (isPortraitView) {
    screenResLandscapeWidth = Capabilities.screenResolutionY;
    screenResLandscapeHeight = Capabilities.screenResolutionX;
}
else {
    screenResLandscapeWidth = Capabilities.screenResolutionX;
    screenResLandscapeHeight = Capabilities.screenResolutionY;
}

Also lets say I have an app with a stage width and height of 600x400 on a device with a 1280x800 screen. I finally had to hardcode these values as some devices would report stage.fullScreenWidth as 600 and at other times report it as the device's screen width of 1280. So I recommend always having your app configure its own internal properties at startup and then have your code only refer to those properties. That way if there's a problem with your app receiving bad data it's much easier to isolate it and code a workaround.

I hope that helps.

grosssmutttr
Known Participant
July 26, 2013
Adobe Employee
July 16, 2013

Seems like it's a device specific and version issue. I tried it with Nexus7(v4.2.2) and it's working very fine. I will try with Samsung Galaxy Tab, the one we have and posted you the result. Are you able to reproduce the issue with any other device?

Regards,

Nimit

grosssmutttr
Known Participant
July 25, 2013

Hi Nimit,

we only know the specific device mentioned above and that Samsung Apps rejected all our apps because of the WSVGA devices.

Adobe Employee
July 25, 2013

I tried with Samsung Galaxy Tab 2 gt-3100(v4.1.2) but the crash is not reproducible with the application.xml setting you mentioned above. Please see the sample application attached at https://www.dropbox.com/s/xapvihwf33z545i/SamsungTabExample.zip , also requesting you to share a sample application so that I can give it a try.

Also, can you try with some other device with same configuration to check if the crash is reproducible.

Regards,

Nimit