# Android scaling and orientation

**URL:** <https://phaser.discourse.group/t/android-scaling-and-orientation/1648>\
**Category:** Phaser 3\
**Created:** [March 11, 2019, 7:08pm UTC](https://phaser.discourse.group/t/android-scaling-and-orientation/1648 "2019-03-11T19:08:02Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![yannick](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/yannick/32/732_2.png) [@yannick](https://phaser.discourse.group/u/yannick)\
**Post date:** [March 13, 2019, 12:11pm UTC](https://phaser.discourse.group/t/android-scaling-and-orientation/1648/8 "2019-03-13T12:11:27Z")

</div>

If you only use the game on a mobile device (where you do not have to resize the game during game play), the strategy below would be the simplest. It will scale the game in width based on the display ratio.

```javascript
window.addEventListener('load', () => {
  // setTimeout to 1 second will prevent a bug if you using a splash screen
  window.setTimeout(() => {
    // fix the height to 720
    const DEFAULT_HEIGHT = 720
    // adjust the width dynamically based on the device screen ratio
    const DEFAULT_WIDTH = (window.innerWidth / window.innerHeight) * DEFAULT_HEIGHT

    const config = {
      //...
      scale: {
        mode: Phaser.Scale.FIT,
        autoCenter: Phaser.Scale.CENTER_BOTH,
        width: DEFAULT_WIDTH,
        height: DEFAULT_HEIGHT
      },
      //...
    }
    new Phaser.Game(config)
  }, 1000)
})

```

---

_[View the full topic](https://phaser.discourse.group/t/android-scaling-and-orientation/1648)._
