Skip to main content
Inspiring
January 20, 2014
Answered

Kindle Fire HD auto orientation is upside down

  • January 20, 2014
  • 3 replies
  • 21480 views

Hi,

Has anyone else had the problem of the kindle fire HD orientation being upside down when auto orientation is turned on for landscape? Is there anyway to fix it?

This topic has been closed for replies.
Correct answer Colin Holgate

Yes. Also, the original Kindle Fire had the same issue, but for a different reason. There are various works arounds to the issue, but most of those have serious possible side effects. Here’s a description of the general problem:

If the user holds the Kindle Fire the correct way up (either the USB connector is to the right if there is no camera, or the camera is at the top or left if there is a camera), everything works ok.

If the user is holding it the other way up (by the way, I’m just describing landscape here), then on the original Kindle Fire it may work, but on the new ones it will be upside down.

If you do a fix for that, the app will be correct, but if the user turns the device at all, the app becomes upside down, and remains that way until they force quit.

So, after a lot of attempted fixes the only way I found to make it predictable was to turn off auto rotation and to also do a work around for the initial incorrectness.

Now, because the original Kindle Fire has the opposite issue to the later ones, I have to work around its issues in the opposite way. Which means finding a way to detect an old Kindle Fire versus a newer one. One way to do that is to check the screen size.

No other Android device has these issues, so you have to tell whether you should be attempting the work around at all. I use a variable that tells me that the app was bought n the Amazon Appstore for that. If it was, I do the Kindle Fire work arounds. If it wasn’t, I don’t.

The final work around code is like this (the timer is used because at first the orientation may return "unknown"):

private var screenwidth: int = Math.max(Capabilities.screenResolutionX, Capabilities.screenResolutionY);

private var screenheight: int = Math.min(Capabilities.screenResolutionX, Capabilities.screenResolutionY);

private var store:String = "amazon";//amazon or empty;

private var fixtimer:Timer = new Timer(10,200);

if(store=="amazon"){

          fixtimer.addEventListener(TimerEvent.TIMER,fixrot);

          fixtimer.start();

}

private function fixrot(e: TimerEvent) {

    if (stage.deviceOrientation != "unknown") {

      fixtimer.stop();

      fixtimer.removeEventListener(TimerEvent.TIMER, fixrot);

    } else {

      return;

    }

    var oldkindle: Boolean = false;

    if (screenwidth == 1024 && screenheight == 600) oldkindle = true;

    if (!oldkindle) {

      if (stage.deviceOrientation == "rotatedLeft") {

        stage.setOrientation("rotatedLeft");

      }

    } else {

      if (stage.deviceOrientation == "rotatedRight") {

        stage.setOrientation("rotatedLeft");

      } else {

        if (stage.deviceOrientation == "rotatedLeft") {

          stage.setOrientation("rotatedRight");

        }

      }

    }

}

3 replies

GusPineda
Participant
March 17, 2014

Actually I had the same issue, it is hard to test on an Android device, you need an Kindle in order to test it.

the following code fix the issue in all Kindle's , Just create a version for Kindle and add the code below:

var cOrientation:String;

setInterval(function(){

//If we've already forced this orientation, we don't need to do it again.

if(stage.deviceOrientation == cOrientation){ return; }

//Force stage orientation to match device

if(stage.deviceOrientation == StageOrientation.ROTATED_LEFT){

stage.setOrientation(StageOrientation.ROTATED_LEFT);

}

else if(stage.deviceOrientation == StageOrientation.ROTATED_RIGHT){

stage.setOrientation(StageOrientation.ROTATED_RIGHT);

}

cOrientation = stage.deviceOrientation;

}, 1000);

This has fix the issue on two of my apps on Kindle, AirportBoard and Boongo

http://www.amazon.com/s/ref=nb_sb_noss_2?url=search-alias%3Dmobile-apps&field-keywords=boongo&rh=n%3A2350149011%2Ck%3Aboongo

http://www.amazon.com/s/ref=nb_sb_noss?url=search-alias%3Dmobile-apps&field-keywords=airportboard

Colin Holgate
Inspiring
March 17, 2014

Thanks, I may try that.

Participant
December 4, 2020

This is a real pain for non programers . I just bought my wife a Fire 8 tablet and she won't use it because the after market case handle is on the wrong side. Thus, her game is upside down in portrait and too hard to hold. I changed this one to use Google Play store apps...I just unloaded the Amazon app for "Parlor" and reinstalled from Playstore, still flips to opposite 180 😞

I can live with it, but she will not give up her old Samsung and the Fire is now just for guests 😞

I took around in Linx, but I do not know programming so this is a royal pain.

Seems like the code in the Fire is an Anazon issue, btw both apps were from their store. 

I cannot just flip the case, because sadly  the speakers would be covered 😞

Turning off auto rotate is irrelevant to our issue.

Good luck.

Dave

Participant
January 28, 2014

Hi Colin, is this IF necessary? I don't know if it was a typo, or if doesn't need to be there:


      if (stage.deviceOrientation == "rotatedLeft") {

        stage.setOrientation("rotatedLeft");

      }

It looks like one of them should be right instead of left, because with these lines inside the if(!oldKindle) means that there's not any change for the new kindle (HD).

Colin Holgate
Inspiring
January 28, 2014

Yes, part of the problem is that the stage orientation claimed by the new Kindle Fire is incorrect, it’s really the opposite at the time, but when told to go to that orientation it does the right thing. Even with auto orientation turned off, and the work around in place, the new Kindle Fires open with the status bar upside down. Hopefully by the time the app is loaded the screen is the right way up, but if it’s not it does so as soon as that line is reached.

Participant
January 28, 2014

Thanks for you answer Colin. Anyway I have a problem with this, the game never rotates, if I want to rotate the device 180 degrees, it doesn't work.

Im making some tests setting autoOrients to true, and using the event StageOrientationEvent.ORIENTATION_CHANGE to know when the device is rotating, so I can set the proper value (left or right) to avoid the bug.

Let me know if you already have a solution for that or if your code should be working fine and Im missing something.

Colin Holgate
Colin HolgateCorrect answer
Inspiring
January 20, 2014

Yes. Also, the original Kindle Fire had the same issue, but for a different reason. There are various works arounds to the issue, but most of those have serious possible side effects. Here’s a description of the general problem:

If the user holds the Kindle Fire the correct way up (either the USB connector is to the right if there is no camera, or the camera is at the top or left if there is a camera), everything works ok.

If the user is holding it the other way up (by the way, I’m just describing landscape here), then on the original Kindle Fire it may work, but on the new ones it will be upside down.

If you do a fix for that, the app will be correct, but if the user turns the device at all, the app becomes upside down, and remains that way until they force quit.

So, after a lot of attempted fixes the only way I found to make it predictable was to turn off auto rotation and to also do a work around for the initial incorrectness.

Now, because the original Kindle Fire has the opposite issue to the later ones, I have to work around its issues in the opposite way. Which means finding a way to detect an old Kindle Fire versus a newer one. One way to do that is to check the screen size.

No other Android device has these issues, so you have to tell whether you should be attempting the work around at all. I use a variable that tells me that the app was bought n the Amazon Appstore for that. If it was, I do the Kindle Fire work arounds. If it wasn’t, I don’t.

The final work around code is like this (the timer is used because at first the orientation may return "unknown"):

private var screenwidth: int = Math.max(Capabilities.screenResolutionX, Capabilities.screenResolutionY);

private var screenheight: int = Math.min(Capabilities.screenResolutionX, Capabilities.screenResolutionY);

private var store:String = "amazon";//amazon or empty;

private var fixtimer:Timer = new Timer(10,200);

if(store=="amazon"){

          fixtimer.addEventListener(TimerEvent.TIMER,fixrot);

          fixtimer.start();

}

private function fixrot(e: TimerEvent) {

    if (stage.deviceOrientation != "unknown") {

      fixtimer.stop();

      fixtimer.removeEventListener(TimerEvent.TIMER, fixrot);

    } else {

      return;

    }

    var oldkindle: Boolean = false;

    if (screenwidth == 1024 && screenheight == 600) oldkindle = true;

    if (!oldkindle) {

      if (stage.deviceOrientation == "rotatedLeft") {

        stage.setOrientation("rotatedLeft");

      }

    } else {

      if (stage.deviceOrientation == "rotatedRight") {

        stage.setOrientation("rotatedLeft");

      } else {

        if (stage.deviceOrientation == "rotatedLeft") {

          stage.setOrientation("rotatedRight");

        }

      }

    }

}

Inspiring
January 20, 2014

Thanks Colin. To be on the safe side I'm just going to turn auto orientation off.

Colin Holgate
Inspiring
January 20, 2014

I may not have made it clear, I also turn off auto orientation as part of the fix. Even with that off you have to work around the upside down app problem.