# Not getting proper height in unity when android device has notch or navigation bar on screen

Screen.height is not giving the proper resolution of an Android device when that device has a notch or navigation bar.

Due to this there is offset at bottom of screen:

Here I have set the Admob banner to display at the bottom. But it shows with some offset away from the bottom edge of the screen.

How can I get the proper height of the device in Unity and work with the notch on devices that have them?

• Your question is unclear. When you say Screen.height does not give proper resolution, do you mean it returns the space your game occupies and not the actual screen space? Because that's what supposed to happen, at least on android versions where the navigation bar is never minimised. Also you mention "Due to this, there is offset at the bottom of the screen". This does not make sense to me, are you saying that Unity produces a game that by default does not occupy the whole screen? Dec 6 '18 at 11:29
• I meant when i use Screen.height it give me 2156 but my screen resolution is 1080 X 2246. So i should get 2246 and I am new to unity Dec 6 '18 at 11:33

Screen.height returns the amount of pixels on the screen that are available to your app. In older versions of android the navigation bar would always remain static on the screen, eating a portion of it. This means that any app that runs does not have access on that portion of the screen. That is not an error, it's how the Android OS works, and in my opinion, it's the correct thing to do.
• @WrongTurn why do you need to find the notch area? The OS gives your game a specific space (Screen.width x Screen.height), you can only draw on that space. Android does not let developers mess with the notch so that it's not abused. Dec 6 '18 at 11:55