Jump to content
alejandro.sawers

Android 15 and edge-to-edge enforcement

Recommended Posts

When targeting Android 15 (API level 35) the system now enforces edge-to-edge UI. As described in the documentation apps not designed to be edge-to-edge could expect issues with app content being hidden by the status bar, nav bar, etc.

FMX Android apps seem to be impacted. Here is a test on a blank Delphi 12.0 Android app: when targeting Android 14 (first image) the UI is ok, but when targeting Android 15 (second image) the sample button gets behind the status bar and is not clickable.

 

target_android14.thumb.png.a8de402d297c40c80817ece39ec79ea6.pngtarget_android15.thumb.png.7a6a03a2765d08ba3a59f872693b26d6.png

 

Effectively a breaking change. The official docs give instructions on how to make an app edge-to-edge compliant, however I'm not sure how these instructions could be applied to FMX apps (I'm not really well versed on native Android development) or if a workaround exists by patching .pas source files. I hope the latter is possible.

 

Share this post


Link to post

The Android version / SDK targeting requirements are a year behind releases. Only on 31 Aug 2024 are new apps and updates required to target Android 14 / API 34 (with extension to November on request). Delphi has often barely made this more relaxed requirement so I wouldn't expect Android 15 / API 35 support anytime soon.

 

Target API level requirements for Google Play apps - Play Console Help

Share this post


Link to post
8 hours ago, alejandro.sawers said:

Well, guess the best I can do for now is raise a ticket on the support portal and wait for the best.

You could just leave AndroidManifest.template.xml as it is (for now) - is there some reason you need to target API level 35? If you really need to, you could use code from Kastri to implement a workaround, thus:

uses
  DW.UIHelper, DW.Android.Helpers;

{ TForm1 }

procedure TForm1.FormResize(Sender: TObject);
begin
  // This method is used because the device might have Android 15, but the targetSdkVersion might be lower. Use conditionals if targeting other platforms
  if TAndroidHelperEx.CheckBuildAndTarget(35) then
  begin
    Padding.Top := TUIHelper.GetStatusBarOffset;
    // "Cheat" method for determining whether Portrait or Landscape
    if Screen.Width < Screen.Height then
      Padding.Bottom := TUIHelper.GetNavigationBarOffset
    else
      Padding.Bottom := 0;
  end;
end;

If you don't want to drag the dependent units from Kastri into your app, you could extract the parts of the code that you need.

  • Thanks 1

Share this post


Link to post
12 hours ago, Dave Nottage said:

is there some reason you need to target API level 35?

Not right now, but I know sometimes Embarcadero can miss things like these and put us in a hurry eventually.

12 hours ago, Dave Nottage said:

you could use code from Kastri to implement a workaround

I tried this with the same FMX app (I had to put a Client aligned TLayout for Padding to work and then the TButton inside it) and voila:

 

android15_padding.thumb.png.08c42ea72e932b51d50c3bb61cde1478.png

 

Thanks Dave. This should work until an official fix is given.

  • Like 2

Share this post


Link to post

<OT>
Thanks for pointing to this.

I did not stumble into this issue yet, buut .... maybe ....

It could explain the nasty misbehaviour I had recently with the GoogleMaps App herself.
The lower buttons didn't react and it was not possible to operae as it should.

I had the verdict that an recent update of the Samsung S23 Ultra caused this issue, but perhaps somehow remotely related to above behaviour.
At least no visual effect appears anyhow, as far I can say, only un-clickable in the footer row.

</OT>

Share this post


Link to post

Given your latest findings on this other thread looks like your problem is not related to Android 15 after all. That and also the fact that Samsung is the one who takes the most time to release Android upgrades (or at least it was that way a few years ago).

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×