Delphi 11 Alexandria has landed! In this article, I’ll highlight a couple of the new features, introduce some changes related to the Kastri library, and make a pre-announcement about Codex.

Introduction

As per the headline, I’ll be examining a couple of the new features of Delphi 11. For more complete information, please visit the Embarcadero Blogs, and Marco Cantu’s Blog

API level 30 support

A Google Play store requirement is that from August 1st, new apps must target API level 30. Delphi 11 now gives full support for API level 30.

Full AndroidX (aka JetPack) support

This is a major change for Delphi, which now makes possible (previously close to “impossible”, see the “A word..” section, below) implementation and/or updates of some key features. One of those features is Biometric support across all supported versions of Android. Yes, there are direct Biometric APIs, however these require an API level 29 (Android 10) device or higher. Another is Firebase Analytics, which requires a later version of the Play Services libraries (which Delphi 11 now uses) that depends on AndroidX.

In App Purchases supports the new Billing API

From August 1st this year, new apps that use Google Play Billing are required to support at least v3 of the Billing API. Some good news is that v4 is already supported “out of the box”. Even better: there is no need to change any of your code!

FMX TWebBrowser now supports Edge

Delphi 11 introduces long awaited support for Edge browser, and it is implemented similarly to the TEdgeBrowser component in the VCL, however of course you can use the FMX TWebBrowser on any platform; just that now: Edge is supported on Windows.

Important Breaking Change

There’s a couple of “breaking” changes to Delphi 11, however this one is going to be very visible if your applications request permissions at runtime using PermissionsService: The types of the parameters for permissions handling methods have been changed to better support C++Builder. Namely,

  • TRequestPermissionsResultEvent
  • TRequestPermissionsResultProc
  • TDisplayRationaleEvent
  • TDisplayRationaleProc

For the relevant type of methods/procedures, the APermissions parameter has changed from TArray<string> to TClassicStringDynArray (which is an array of string) and the AGrantResults parameter has changed from TArray<TPermissionStatus> to TClassicPermissionStatusDynArray (which is an array of TPermissionStatus).

Changes to Kastri

Supported versions

In line with the policy regarding supported versions of Delphi, Kastri now “officially” supports Delphi 11 and Delphi 10.4.2. That simply means that fixes are much less likely to be considered for earlier versions.

Change related to the “Important Breaking Change”, above

In order to support both Delphi 11 and Delphi 10.4.x, I have changed the DW.Permissions.Helpers unit to declare types that are compatible with each version. This means that you can use TPermissionArray and TPermissionStatusArray types and your code will compile for either version.

Updates to jars, demos

Due to the addition of full AndroidX support in Delphi 11, there were changes necessary for some of the existing jars that use the Android Support APIs. These have been updated to use AndroidX, and have a suffix of 2.0.0 (e.g dw-kastr-base-2.0.0.jar). Jars with this suffix can be used only in Delphi 11 (or higher). Demos that use these jars now have an additional project that has the name suffixed with D11, e.g. ConnectivityDemoD11.

Features coming soon

With the introduction of full support for AndroidX, it’s now possible to implement some key features, as mentioned above.

Firebase Analytics support will soon be added to Kastri. This means that events such as from Firebase Cloud Messaging will now be included automatically, as well as giving developers the opportunity to log custom events.

Previously Kastri had support for fingerprint only biometrics on Android. Coming soon is support for the Biometrics API, which includes any biometric feature implemented on the OS, such as Face ID.

Note that the above feature changes (aside from Firebase Analytics on iOS) apply to Delphi 11 only – the features are not available for Delphi 10.4.2

New imports

Some new features required imports for the relevant APIs, so they are now included, and are in the API folder.

More coming!

Working on the changes/features related to Delphi 11 means that some other upcoming features needed to take a back seat, e.g a simple implementation for Google SignIn, expansion of the Native Controls suite, and improvements to Camera support.

Codex update

Speaking of more coming: an update to Codex is close to ready. Version 1.5 will support Delphi 11 Alexandria and Delphi 10.4.x Sydney. A separate article announcing Codex 1.5 will follow this one.

Please consider sponsorship

All the changes/updates to Kastri (and other related projects) rely solely on sponsorship, so please consider becoming a Github sponsor of Delphi Worlds today!

A word about AndroidX and earlier versions of Delphi

As mentioned above, being able to take advantage of some features available in AndroidX in earlier versions of Delphi (e.g 10.4.2) would have been close to “impossible”.

It might seem simple: if you want to use a feature in a particular library, you just import the APIs, write your code, and add the library to the Libraries node in the Android platform target, or if the library is a later version of a package already used by Delphi, you disable the older one, and add the newer one. The problem is with dependencies, i.e. the new library may be dependent on newer versions of other libraries that Delphi already uses.

You might then think, OK.. I will just update those too. New problem: existing FMX code may rely on the older versions. The problem then shifts to having to update all the relevant code to comply with the newer version. Some of it may be Delphi code, some of it may be Java code, and the latter means needing to be competent enough with Java, making the changes, recompiling fmx.jar and replacing the old one.

Not exactly “impossible” (hence the quotation marks), however it could amount to a lot of work, which would need to be maintained with future changes.

How deep might the rabbit hole go?

Conclusion

It bears repeating: especially if you’re going to target cross-platform, it is essential that you stay current, so make sure you “take it to 11” with Delphi.