Skip to main content

4 posts tagged with "tips"

View All Tags

· 3 min read
Michael

Android 15 (API v35) includes some changes that are intended to create a more consistent, intuitive user experience.

note

You can read the official release of this information here: https://developer.android.com/about/versions/15/behavior-changes-15

Window inset changes

There are two changes related to window insets in Android 15: edge-to-edge is enforced by default, and there are also configuration changes, such as the default configuration of system bars.

Edge-to-edge enforcement

Apps are edge-to-edge by default on devices running Android 15 if the app is targeting Android 15 (API level 35).

An app that targets Android 14 and is not edge-to-edge on an Android 15 device. The application is contained within the window insets.

After updating your target sdk to 35 you will find that your application is now expected to handle the window insets and is rendered edge-to-edge. However, many elements are now hidden by the status bar, 3-button navigation bar, or display cutout due to the Android 15 edge-to-edge enforcements.

You will need to update your application to correctly handle rendering within the window insets and render within these bounds so UI elements are not hidden.

Handling window insets

To get the safe area to render you can use the Application extension to retrieve the display cutout information:

var displayCutout:DisplayCutout = Application.service.display.getDisplayCutout();

This object contains 4 properties: safeInsetBottom, safeInsetTop, safeInsetLeft, safeInsetRight, each indicating the number of pixels from the edge of the screen that system bars or cutouts may affect.

There is also an boundingRects property containing detailed areas for any cutouts that may affect rendering.

You can use this to apply bounds to your root content "safe area", eg using a starling _safeArea object for rendering UI elements you can use something like the following :

if (Application.isSupported)
{
var cutout:DisplayCutout = Application.service.display.getDisplayCutout();
var topInset:Number = cutout.safeInsetTop / _scale;
var bottomInset:Number = cutout.safeInsetBottom / _scale;
var leftInset:Number = cutout.safeInsetLeft / _scale;
var rightInset:Number = cutout.safeInsetRight / _scale;

_safeArea.setTo(leftInset, topInset,
_stageWidth - leftInset - rightInset,
_stageHeight - topInset - bottomInset);
}
note

If you use immersive mode or change display modes at any time in your application you should ensure to reapply these corrections afterwards.

Cutouts

If your app targets SDK 35 and is running on an Android 15 device, LayoutMode.CUTOUT_ALWAYS is the default behavior. This means that if you were previously relying on setting the LayoutMode eg via calling

Application.service.display.setDisplayMode( 
DisplayMode.FULLSCREEN,
LayoutMode.CUTOUT_NEVER );

this will be interpretted as "always" and your content will be drawn into cutout regions.

Opt-out

As a temporary workaround you can opt-out of this edge-to-edge enforcement in v35.

caution

This option to opt-out will be removed once you update to target v36, so this workaround should only be treated as temporary.

Firstly, create a custom resources folder in your application and package it according to the guide here.

Under your resources folder create a values-v35 folder and add a file styles.xml into this folder with the following content:

styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>

<style name="Theme.NoShadow" parent="android:style/Theme.NoTitleBar">
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
</style>

</resources>

The android:windowOptOutEdgeToEdgeEnforcement option is the critical one that will disable this edge-to-edge enforcement for Android 35.

· 5 min read
Michael

Startup time of an application is often key in retaining your users so it can be critical to make start time as short as possible.

One factor that can contribute to the startup time of an AIR application is loading the definitions for the functionality in native extensions. This is normally done by AIR automatically however with the latest AIR release you can now specify an option on an extension in your application to delay load the extension functionality.

· 2 min read
Michael

If you are publishing games to the AppStore for iOS you may have recently received an notification along the following lines:

Upcoming Game Center entitlement requirement

Starting August 16, 2023, new apps and app updates that offer Game Center features need to include the Game Center entitlement and have Game Center features configured in App Store Connect before you can submit them to the App Store. Existing apps on the App Store are not affected by this new requirement.

We noticed that although the apps listed below have Game Center features configured in App Store Connect, their latest binary delivery doesn’t include the Game Center entitlement. In your next app update, please update your binary to include the entitlement.

There are two important things you need to do to your application in order to meet this new requirement.

Firstly, make sure the capability is enabled in "Certificates, Identifiers & Profiles" for your application in the developer portal. Then update and download your provisioning profiles to ensure they are updated with the new capability.

Then in your application descriptor you will need to add the entitlement. If you are using apm just ensure you are using the latest version and then generate your app descriiptor, apm will ensure the entitlement is correctly added.

If you are manually managing your app descriptor additions then you will need to add the following to the Entitlements node under iPhone:

<iPhone>
<Entitlements><![CDATA[

<key>com.apple.developer.game-center</key>
<true/>

]]></Entitlements>
</iPhone>

Once you have followed these steps your application will support this new requirement and you will be able to submit your application to the AppStore.

· 2 min read
Michael

At some point in your application development when you start to store and share data you will need to handle user GDPR settings.

GDPR

The General Data Protection Regulation (GDPR) is a European Union (EU) regulation that mandates how an organisation should handle personal data.

If you use personalised advertising or store user related data on your server then you will need to address GDPR concerns in your application.