I recently set up a project using Ionic with Capacitor version 6, and I’ve encountered an issue where the safe area values on Android are consistently returning zero. I’m currently on Android 14, using Java 17, and Gradle 8.6. However, everything works perfectly on iOS.
Could anyone provide insights or solutions to this issue?
App.vue should be fine. It gets mounted in main.ts. Does your modal have a ion-header and ion-toolbar?
Ionic automatically adds padding to certain components. For example, the first ion-toolbar component placed in an ion-modal will receive padding according to the top edge of the device’s safe area. - (source)
I ended up doing the following to account for the differences between Android versions <= 14 (where I set the status bar overlay to false) and Android >= 15 (where I let the status bar overlay default to true). This was necessary in my case because setting overlay to true in older versions was fixing the system nav bar but breaking my header layout due to the top status bar’s position. There are other ways to address that problem, but this was my quick solution.