# \[FIXED\] Safe area in Android works... sometimes?

**URL:** <https://forum.defold.com/t/fixed-safe-area-in-android-works-sometimes/82471>\
**Category:** Questions\
**Created:** [March 3, 2026, 4:38pm UTC](https://forum.defold.com/t/fixed-safe-area-in-android-works-sometimes/82471 "2026-03-03T16:38:10Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![playmedusa](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/playmedusa/32/33755_2.png) [@playmedusa](https://forum.defold.com/u/playmedusa)\
**Post date:** [March 3, 2026, 4:38pm UTC](https://forum.defold.com/t/fixed-safe-area-in-android-works-sometimes/82471/1 "2026-03-03T16:38:10Z")

</div>

I’m so happy with the new [Defold 1.12.2](https://forum.defold.com/t/defold-1-12-2-has-been-released/82464)! It fixed indeed the gui.pick\_node() issue but… Does it happen to you that the safe area works erratically?

Sometimes I open up my app and it works, sometimes (same app, no new build), I open it up and it ignores the safe area, with buttons being drawn where they shouldn’t. Am I missing something?

---

<div class="post-metadata">

**Author:** ![Visionaire](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/visionaire/32/34415_2.png) [@Visionaire](https://forum.defold.com/u/Visionaire)\
**Post date:** [March 3, 2026, 5:45pm UTC](https://forum.defold.com/t/fixed-safe-area-in-android-works-sometimes/82471/2 "2026-03-03T17:45:42Z")

</div>

No safe area!

![none](https://forum-defold-uploads.b-cdn.net/original/3X/9/b/9bd30f2235ff5e142c92e5914ae0a340bb28a5dd.png)

 ![Screenshot_20260303-111859](https://forum-defold-uploads.b-cdn.net/original/3X/a/6/a655930a4ecc2dfca60e7148afd777236faa9fa6.png)

With safe area in any of your options you have a mismatch at the center point!

 ![side-6](https://forum-defold-uploads.b-cdn.net/original/3X/f/3/f38a47afd2f71c07dd23e41396b55ff4b16c717b.png)

 ![Screenshot_20260303-112002](https://forum-defold-uploads.b-cdn.net/original/3X/b/1/b17004cd3b43b016f12db4ae237d769dc50298ca.png)

Sorry it doesn’t get corrected!

 ![Captura desde 2026-03-03 11-35-53](https://forum-defold-uploads.b-cdn.net/original/3X/4/1/41d6f2ef9486ce40498a47de411cfb74ab77a6f7.png)

 ![Screenshot_20260303-124644](https://forum-defold-uploads.b-cdn.net/original/3X/e/b/eb78ba73249250eb3dbb99cf47a94aead8525818.png)

These tests were done in a 1920x1080px resolution.

If you have different resolutions, I recommend you do this [Layouts | Defold](https://defold.com/examples/gui/layouts/)

---

<div class="post-metadata">

**Author:** ![playmedusa](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/playmedusa/32/33755_2.png) [@playmedusa](https://forum.defold.com/u/playmedusa)\
**Post date:** [March 3, 2026, 5:56pm UTC](https://forum.defold.com/t/fixed-safe-area-in-android-works-sometimes/82471/3 "2026-03-03T17:56:43Z")

</div>

But I am using safe area (and immersive mode is on). Feels like safe are is not being found when launching the app?

But it’s funny because it’s the opposite error from the pick\_node() issue! Now the button is inside the safe area, but I do have to click where it SHOULD be for it to work!?

 ![safearea](https://forum-defold-uploads.b-cdn.net/original/3X/6/d/6d7bb39192a36f1d7f4e00f55ed4194e08be3a61.jpeg)

---

<div class="post-metadata">

**Author:** ![Visionaire](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/visionaire/32/34415_2.png) [@Visionaire](https://forum.defold.com/u/Visionaire)\
**Post date:** [March 3, 2026, 6:12pm UTC](https://forum.defold.com/t/fixed-safe-area-in-android-works-sometimes/82471/5 "2026-03-03T18:12:19Z")

</div>

That happens when example:

Your gui node has a resolution of 960x540…

And the device has a higher or lower resolution than your gui node!

There the position of your buttons is out of step and… 👇

> [@playmedusa](#):
>
> But it’s funny because it’s the opposite error from the pick\_node() issue! Now the button is inside the safe area, but I do have to click where it SHOULD be for it to work!?

> [@Visionaire](#):
>
> I recommend you do this [Layouts](https://defold.com/examples/gui/layouts/)

It’s a bit tedious but with this you can create different layout measurements (960x540, 1920x1080, etc) the device itself detects the layout measurement!

---

<div class="post-metadata">

**Author:** ![playmedusa](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/playmedusa/32/33755_2.png) [@playmedusa](https://forum.defold.com/u/playmedusa)\
**Post date:** [March 3, 2026, 6:15pm UTC](https://forum.defold.com/t/fixed-safe-area-in-android-works-sometimes/82471/6 "2026-03-03T18:15:01Z")

</div>

I do have my layouts, that button is a child of the top-left corner node, which correctly places itself when resolution changes. And indeed, if I don’t use the safe area and simply place my button 100 pixels down from the top-left corner, it’s out of the device’s safe area and I can click it. But safe are should do that automatically, right? That’s its whole reason to exist 😃

---

<div class="post-metadata">

**Author:** ![Visionaire](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/visionaire/32/34415_2.png) [@Visionaire](https://forum.defold.com/u/Visionaire)\
**Post date:** [March 3, 2026, 6:24pm UTC](https://forum.defold.com/t/fixed-safe-area-in-android-works-sometimes/82471/7 "2026-03-03T18:24:43Z")

</div>

> <https://github.com/defold/defold/pull/11874>
>
> This fixes an issue with touch events being offset when using \`gui.pick\_node()\` …in combination with the new built-in safe area mode.
> 
> Fix https://github.com/defold/defold/issues/11870

---

<div class="post-metadata">

**Author:** ![playmedusa](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/playmedusa/32/33755_2.png) [@playmedusa](https://forum.defold.com/u/playmedusa)\
**Post date:** [March 3, 2026, 6:35pm UTC](https://forum.defold.com/t/fixed-safe-area-in-android-works-sometimes/82471/8 "2026-03-03T18:35:04Z")

</div>

I don’t think I’m explaining myself…

The issue is that safe area sometimes works (GUI is pushed out of the safe area and I can click on buttons thanks to that fix) and sometimes safe are does not work and GUI nodes are not pushed out of the safe are, as seen on the image I attached.

It works erratically. But when it works it works well now after the last update.

---

<div class="post-metadata">

**Author:** ![Visionaire](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/visionaire/32/34415_2.png) [@Visionaire](https://forum.defold.com/u/Visionaire)\
**Post date:** [March 3, 2026, 6:38pm UTC](https://forum.defold.com/t/fixed-safe-area-in-android-works-sometimes/82471/9 "2026-03-03T18:38:24Z")

</div>

It is an intermittent failure 🤔

---

<div class="post-metadata">

**Author:** ![playmedusa](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/playmedusa/32/33755_2.png) [@playmedusa](https://forum.defold.com/u/playmedusa)\
**Post date:** [March 3, 2026, 7:00pm UTC](https://forum.defold.com/t/fixed-safe-area-in-android-works-sometimes/82471/10 "2026-03-03T19:00:10Z")

</div>

Exactly. When I launch the app sometimes those buttons are properly pushed out of the safe area and I can click on them, sometimes they are not pushed VISUALLY, but if I tap where they should be it works.

---

<div class="post-metadata">

**Author:** ![AGulev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/agulev/32/4541_2.png) [@AGulev](https://forum.defold.com/u/AGulev)\
**Post date:** [March 3, 2026, 7:50pm UTC](https://forum.defold.com/t/fixed-safe-area-in-android-works-sometimes/82471/11 "2026-03-03T19:50:56Z")

</div>

> [@playmedusa](#):
>
> But I am using safe area (and immersive mode is on). Feels like safe are is not being found when launching the app?

Please, create a small project I can use for tests and open an issue [GitHub · Where software is built](https://github.com/defold/defold/issues)

Provide as much info as possible about the phone you are testing on.

---

<div class="post-metadata">

**Author:** ![playmedusa](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/playmedusa/32/33755_2.png) [@playmedusa](https://forum.defold.com/u/playmedusa)\
**Post date:** [March 4, 2026, 7:54am UTC](https://forum.defold.com/t/fixed-safe-area-in-android-works-sometimes/82471/12 "2026-03-04T07:54:24Z")

</div>

> [@playmedusa](#):
>
> safe area sometimes works (GUI is pushed out of the safe area and I can click on buttons thanks to that fix) and sometimes safe are does not work and GUI nodes are not pushed out of the safe are, as seen on the image I attached.
> 
> It works erratically. But when it works it works well now after the last update.

Here: [Safe area node positions acting erratically · Issue #11979 · defold/defold · GitHub](https://github.com/defold/defold/issues/11979)

Hope it sheds some light! Feels like a setup/start race of some kind. Sometimes it works one way, sometimes it works in a different way.

---

<div class="post-metadata">

**Author:** ![Sam](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/sam/32/41902_2.png) [@Sam](https://forum.defold.com/u/Sam)\
**Post date:** [March 4, 2026, 11:21am UTC](https://forum.defold.com/t/fixed-safe-area-in-android-works-sometimes/82471/13 "2026-03-04T11:21:41Z")

</div>

I had some free time and did a bit of tinkering inside your project.

I can confirm the issue — every 3–4 launches the app behaves strangely.

I’m not entirely sure why this works, but removing the `@render` messages seems to fix the problem:

```Lua
msg.post("@render:", "use_fixed_fit_projection", { near = -1, far = 1 })
msg.post("@render:", "use_camera_projection")

```

After removing these lines the issue no longer appears on my device.

---

<div class="post-metadata">

**Author:** ![playmedusa](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/playmedusa/32/33755_2.png) [@playmedusa](https://forum.defold.com/u/playmedusa)\
**Post date:** [March 4, 2026, 1:06pm UTC](https://forum.defold.com/t/fixed-safe-area-in-android-works-sometimes/82471/14 "2026-03-04T13:06:01Z")

</div>

Oh, would be nice to know why removing those solves the issue… and also why I still have them there. I probably can remove them safely in my projects!

---

<div class="post-metadata">

**Author:** ![AGulev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/agulev/32/4541_2.png) [@AGulev](https://forum.defold.com/u/AGulev)\
**Post date:** [March 5, 2026, 7:45pm UTC](https://forum.defold.com/t/fixed-safe-area-in-android-works-sometimes/82471/15 "2026-03-05T19:45:56Z")

</div>

There is a link in the issue to a build with my fix. It would be great if you could help test it:

> <https://github.com/defold/defold/issues/11979#issuecomment-4007295047>
>
> \*\*Describe the bug (REQUIRED)\*\*
> Safe area sometimes works (GUI is pushed out of …the safe area and I can click on buttons) and sometimes safe are does not work and GUI nodes are not pushed out of the safe are, as seen on the image I attached.
> 
> It works erratically. But when it works it works well now after the last update.
> 
> \*\*To Reproduce (REQUIRED)\*\*
> Steps to reproduce the behavior:
> 
> Launch the app multiple times. Sometimes the top-left button is properly placed, sometimes it's inside the safe area and you can tap where it SHOULD be.
> 
> \*\*Expected behavior (REQUIRED)\*\*
> 
> Top-left button should always be pushed out of the safe area.
> 
> \*\*Defold version (REQUIRED):\*\*
> 1.12.2
> 
> \*\*Platforms (REQUIRED):\*\*
> Android 
> Tested on a Samsung Galaxy A71
> 
> \*\*Screenshots (OPTIONAL):\*\*
> 
> !\[Image\](https://github.com/user-attachments/assets/cfcb3879-01b1-41ee-8b59-67ef86e98250)
> 
> Test project: 
> https://drive.proton.me/urls/7GDJS9GJ7M#YDozqpAptk4t

---

<div class="post-metadata">

**Author:** ![AGulev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/agulev/32/4541_2.png) [@AGulev](https://forum.defold.com/u/AGulev)\
**Post date:** [March 6, 2026, 7:53am UTC](https://forum.defold.com/t/fixed-safe-area-in-android-works-sometimes/82471/16 "2026-03-06T07:53:43Z")

</div>

I explained the issue here: [Safe area node positions acting erratically · Issue #11979 · defold/defold · GitHub](https://github.com/defold/defold/issues/11979#issuecomment-4010138369)  
It’s not related to the safe area logic, it’s a lua error in the render\_script that appears because of `msg.post("@render:", "use_camera_projection"`

---

<div class="post-metadata">

**Author:** ![playmedusa](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/playmedusa/32/33755_2.png) [@playmedusa](https://forum.defold.com/u/playmedusa)\
**Post date:** [March 6, 2026, 3:26pm UTC](https://forum.defold.com/t/fixed-safe-area-in-android-works-sometimes/82471/17 "2026-03-06T15:26:03Z")

</div>

Yes, tested and working! Thank you a lot!
