Verhaltensänderungen: Apps, die auf Android 16 oder höher ausgerichtet sind

Wie bei früheren Versionen enthält Android 16 Verhaltensänderungen, die sich auf Ihre App auswirken können. Die folgenden Verhaltensänderungen gelten ausschließlich für Apps, die auf Android 16 oder höher ausgerichtet sind. Wenn Ihre App auf Android 16 oder höher ausgerichtet ist, sollten Sie sie gegebenenfalls so anpassen, dass sie diese Verhaltensweisen unterstützt.

Sehen Sie sich auch die Liste der Verhaltensänderungen an, die sich auf alle Apps auswirken, die unter Android 16 ausgeführt werden, unabhängig vom targetSdkVersion Ihrer App.

Nutzerfreundlichkeit und System-UI

Android 16 (API-Level 36) enthält die folgenden Änderungen, die für eine einheitlichere, intuitive Nutzererfahrung sorgen sollen.

Deaktivierung von Edge-to-Edge-Anzeigen nicht mehr möglich

Android 15: Edge-to-Edge-Anzeige für Apps, die auf Android 15 (API-Level 35) ausgerichtet sind: Für Apps, die auf Android 15 (API-Level 35) ausgerichtet sind, wird die Edge-to-Edge-Anzeige erzwungen. Sie können die Funktion jedoch deaktivieren, indem Sie R.attr#windowOptOutEdgeToEdgeEnforcement auf true setzen. Bei Apps, die auf Android 16 (API-Level 36) ausgerichtet sind, ist R.attr#windowOptOutEdgeToEdgeEnforcement eingestellt und deaktiviert. Deine App kann nicht deaktivieren, dass sie randlos angezeigt wird.

  • Wenn Ihre App auf Android 16 (API‑Level 36) ausgerichtet ist und auf einem Android 15-Gerät ausgeführt wird, funktioniert R.attr#windowOptOutEdgeToEdgeEnforcement weiterhin.
  • Wenn Ihre App auf Android 16 (API‑Level 36) ausgerichtet ist und auf einem Android 16-Gerät ausgeführt wird, ist R.attr#windowOptOutEdgeToEdgeEnforcement deaktiviert.

Wenn Sie Ihre App unter Android 16 testen, muss sie Edge-to-Edge unterstützen. Entfernen Sie alle Verwendungen von R.attr#windowOptOutEdgeToEdgeEnforcement, damit Ihre App auch auf einem Android 15-Gerät Edge-to-Edge unterstützt. Informationen zur Unterstützung von Edge-to-Edge finden Sie in den Anleitungen zu Compose und Views.

Migration oder Deaktivierung für die Funktion „Vorhersagende Zurück-Geste“ erforderlich

For apps targeting Android 16 (API level 36) or higher and running on an Android 16 or higher device, the predictive back system animations (back-to-home, cross-task, and cross-activity) are enabled by default. Additionally, onBackPressed is not called and KeyEvent.KEYCODE_BACK is not dispatched anymore.

If your app intercepts the back event and you haven't migrated to predictive back yet, update your app to use supported back navigation APIs, or temporarily opt out by setting the android:enableOnBackInvokedCallback attribute to false in the <application> or <activity> tag of your app's AndroidManifest.xml file.

The predictive back-to-home animation.
The predictive cross-activity animation.
The predictive cross-task animation.

Elegant Font APIs eingestellt und deaktiviert

Bei Apps, die auf Android 15 (API‑Level 35) ausgerichtet sind, ist das Attribut elegantTextHeight TextView standardmäßig auf true gesetzt. Dadurch wird die kompakte Schriftart durch eine Schriftart ersetzt, die viel besser lesbar ist. Sie können dies überschreiben, indem Sie das Attribut elegantTextHeight auf false festlegen.

In Android 16 wird das Attribut elegantTextHeight eingestellt. Es wird ignoriert, sobald Ihre App auf Android 16 ausgerichtet ist. Die von diesen APIs gesteuerten „UI-Schriftarten“ werden eingestellt. Sie sollten daher alle Layouts anpassen, um eine konsistente und zukunftssichere Textwiedergabe in Arabisch, Laotisch, Birmanisch, Tamil, Gujarati, Kannada, Malayalam, Odia, Telugu oder Thailändisch zu gewährleisten.

elegantTextHeight-Verhalten für Apps, die auf Android 14 (API-Level 34) oder niedriger ausgerichtet sind, oder für Apps, die auf Android 15 (API-Level 35) ausgerichtet sind und den Standardwert durch Festlegen des Attributs elegantTextHeight auf false überschrieben haben.
elegantTextHeight-Verhalten für Apps, die auf Android 16 (API-Level 36) ausgerichtet sind, oder für Apps, die auf Android 15 (API-Level 35) ausgerichtet sind und den Standard nicht überschrieben haben, indem sie das Attribut elegantTextHeight auf false gesetzt haben.

Hauptfunktion

Android 16 (API-Level 36) umfasst die folgenden Änderungen, die verschiedene Kernfunktionen des Android-Systems modifizieren oder erweitern.

Optimierung der Arbeitsplanung mit festem Tarif

Prior to targeting Android 16, when scheduleAtFixedRate missed a task execution due to being outside a valid process lifecycle, all missed executions immediately execute when the app returns to a valid lifecycle.

When targeting Android 16, at most one missed execution of scheduleAtFixedRate is immediately executed when the app returns to a valid lifecycle. This behavior change is expected to improve app performance. Test this behavior in your app to check if your app is impacted. You can also test by using the app compatibility framework and enabling the STPE_SKIP_MULTIPLE_MISSED_PERIODIC_TASKS compat flag.

Formfaktoren von Geräten

Android 16 (API-Level 36) enthält die folgenden Änderungen für Apps, die auf Geräten mit großen Bildschirmen angezeigt werden.

Adaptive Layouts

With Android apps now running on a variety of devices (such as phones, tablets, foldables, desktops, cars, and TVs) and windowing modes on large screens (such as split screen and desktop windowing), developers should build Android apps that adapt to any screen and window size, regardless of device orientation. Paradigms like restricting orientation and resizability are too restrictive in today's multidevice world.

Ignore orientation, resizability, and aspect ratio restrictions

For apps targeting Android 16 (API level 36), Android 16 includes changes to how the system manages orientation, resizability, and aspect ratio restrictions. On displays with smallest width >= 600dp, the restrictions no longer apply. Apps also fill the entire display window, regardless of aspect ratio or a user's preferred orientation, and pillarboxing isn't used.

This change introduces a new standard platform behavior. Android is moving toward a model where apps are expected to adapt to various orientations, display sizes, and aspect ratios. Restrictions like fixed orientation or limited resizability hinder app adaptability, so we recommend making your app adaptive to deliver the best possible user experience.

You can also test this behavior by using the app compatibility framework and enabling the UNIVERSAL_RESIZABLE_BY_DEFAULT compat flag.

Common breaking changes

Ignoring orientation, resizability, and aspect ratio restrictions might impact your app's UI on some devices, especially elements that were designed for small layouts locked in portrait orientation: for example, issues like stretched layouts and off-screen animations and components. Any assumptions about aspect ratio or orientation can cause visual issues with your app. Learn more about how to avoid them and improve your app's adaptive behaviour.

Allowing device rotation results in more activity re-creation, which can result in losing user state if not properly preserved. Learn how to correctly save UI state in Save UI states.

Implementation details

The following manifest attributes and runtime APIs are ignored across large screen devices in full-screen and multi-window modes:

The following values for screenOrientation, setRequestedOrientation(), and getRequestedOrientation() are ignored:

  • portrait
  • reversePortrait
  • sensorPortrait
  • userPortrait
  • landscape
  • reverseLandscape
  • sensorLandscape
  • userLandscape

Regarding display resizability, android:resizeableActivity="false", android:minAspectRatio, and android:maxAspectRatio have no effect.

For apps targeting Android 16 (API level 36), app orientation, resizability, and aspect ratio constraints are ignored on large screens by default, but every app that isn't fully ready can temporarily override this behavior by opting out (which results in the previous behavior of being placed in compatibility mode).

Exceptions

The Android 16 orientation, resizability, and aspect ratio restrictions don't apply in the following situations:

  • Games (based on the android:appCategory flag)
  • Users explicitly opting in to the app's default behavior in aspect ratio settings of the device
  • Screens that are smaller than sw600dp

Opt out temporarily

To opt out a specific activity, declare the PROPERTY_COMPAT_ALLOW_RESTRICTED_RESIZABILITY manifest property:

<activity ...>
  <property android:name="android.window.PROPERTY_COMPAT_ALLOW_RESTRICTED_RESIZABILITY" android:value="true" />
  ...
</activity>

If too many parts of your app aren't ready for Android 16, you can opt out completely by applying the same property at the application level:

<application ...>
  <property android:name="android.window.PROPERTY_COMPAT_ALLOW_RESTRICTED_RESIZABILITY" android:value="true" />
</application>

Gesundheit und Fitness

Android 16 (API-Level 36) enthält die folgenden Änderungen in Bezug auf Gesundheits- und Fitnessdaten.

Berechtigungen für Gesundheit und Fitness

For apps targeting Android 16 (API level 36) or higher, BODY_SENSORS permissions use more granular permissions under android.permissions.health, which Health Connect also uses. As of Android 16, any API previously requiring BODY_SENSORS or BODY_SENSORS_BACKGROUND requires the corresponding android.permissions.health permission instead. This affects the following data types, APIs, and foreground service types:

If your app uses these APIs, it should request the respective granular permissions:

These permissions are the same as those that guard access to reading data from Health Connect, the Android datastore for health, fitness, and wellness data.

Mobile apps

Mobile apps migrating to use the READ_HEART_RATE and other granular permissions must also declare an activity to display the app's privacy policy. This is the same requirement as Health Connect.

Konnektivität

Android 16 (API-Level 36) enthält die folgenden Änderungen am Bluetooth-Stack, um die Verbindung mit Peripheriegeräten zu verbessern.

Neue Intents für den Umgang mit Verlust der Bindung und Änderungen an der Verschlüsselung

Im Rahmen der Verbesserten Verarbeitung von Verbindungsverlusten werden in Android 16 außerdem zwei neue Intents eingeführt, um Apps besser über Verbindungsverluste und Verschlüsselungsänderungen zu informieren.

Für Apps, die auf Android 16 ausgerichtet sind, ist jetzt Folgendes möglich:

  • Sie erhalten eine ACTION_KEY_MISSING-Intent, wenn ein Verlust der Remote-Bindung erkannt wird. So können Sie Nutzern informativeres Feedback geben und entsprechende Maßnahmen ergreifen.
  • Sie erhalten eine ACTION_ENCRYPTION_CHANGE-Intent, wenn sich der Verschlüsselungsstatus des Links ändert. Dazu gehören Änderungen des Verschlüsselungsstatus, des Verschlüsselungsalgorithmus und der Größe des Verschlüsselungsschlüssels. Apps müssen davon ausgehen, dass die Verknüpfung wiederhergestellt wurde, wenn die Verknüpfung nach Erhalt der ACTION_ENCRYPTION_CHANGE-Intent erfolgreich verschlüsselt wurde.

Anpassung an unterschiedliche OEM-Implementierungen

Diese neuen Intents werden in Android 16 eingeführt, ihre Implementierung und Übertragung kann jedoch je nach Gerätehersteller (OEM) variieren. Damit Ihre App auf allen Geräten einheitlich und zuverlässig funktioniert, sollten Entwickler die Verarbeitung von Verbindungsverlusten so gestalten, dass sie sich an diese potenziellen Abweichungen anpasst.

Wir empfehlen folgende App-Verhaltensweisen:

  • Wenn die ACTION_KEY_MISSING-Intent gesendet wird:

    Die ACL-Verbindung (Asynchronous Connectionless) wird vom System getrennt, die Informationen zur Bindung für das Gerät bleiben jedoch erhalten (wie hier beschrieben).

    Ihre App sollte diese Intent als primäres Signal für die Erkennung von Verbindungsverlusten verwenden und den Nutzer auffordern, zu bestätigen, dass sich das Remotegerät in Reichweite befindet, bevor das Gerät vergessen oder neu gekoppelt wird.

    Wenn die Verbindung eines Geräts nach dem Empfang von ACTION_KEY_MISSING getrennt wird, sollte deine App vorsichtig sein, bevor sie eine neue Verbindung herstellt, da das Gerät möglicherweise nicht mehr mit dem System verbunden ist.

  • Wenn die ACTION_KEY_MISSING-Intent NICHT gesendet wird:

    Die ACL-Verbindung bleibt bestehen und die Informationen zur Kopplung des Geräts werden vom System entfernt, genau wie bei Android 15.

    In diesem Fall sollte Ihre App die vorhandenen Mechanismen zur Verarbeitung von Verbindungsverlusten wie in früheren Android-Releases fortsetzen, um Verbindungsverluste zu erkennen und zu verwalten.

Neue Möglichkeit zum Entfernen der Bluetooth-Kopplung

Alle Apps, die auf Android 16 ausgerichtet sind, können jetzt Bluetooth-Geräte über eine öffentliche API in CompanionDeviceManager entkoppeln. Wenn ein Companion-Gerät als CDM-Verknüpfung verwaltet wird, kann die App die Entfernung der Bluetooth-Verknüpfung über die neue removeBond(int) API auf dem verknüpften Gerät auslösen. Die App kann die Änderungen des Kopplungsstatus überwachen, indem sie das Bluetooth-Geräte-Broadcast-Ereignis ACTION_BOND_STATE_CHANGED überwacht.

Sicherheit

Android 16 (API-Level 36) enthält die folgenden Sicherheitsänderungen.

Sperrung der MediaStore-Version

Bei Apps, die auf Android 16 oder höher ausgerichtet sind, ist MediaStore#getVersion() jetzt für jede App eindeutig. Dadurch werden identifizierende Eigenschaften aus dem Versionsstring entfernt, um Missbrauch und Verwendung für Fingerprinting-Techniken zu verhindern. Apps dürfen keine Annahmen über das Format dieser Version treffen. Apps sollten Versionsänderungen bereits bei der Verwendung dieser API verarbeiten und in den meisten Fällen sollte ihr aktuelles Verhalten nicht geändert werden müssen, es sei denn, der Entwickler hat versucht, zusätzliche Informationen abzuleiten, die über den beabsichtigten Umfang dieser API hinausgehen.

Sicherere Intents

Safer Intents ist eine mehrphasige Sicherheitsinitiative, die darauf abzielt, die Sicherheit des Intent-Auflösungsmechanismus von Android zu verbessern. Ziel ist es, Apps vor schädlichen Aktionen zu schützen, indem während der Verarbeitung von Intents Prüfungen durchgeführt und Intents herausgefiltert werden, die bestimmte Kriterien nicht erfüllen.

In Android 15 lag der Fokus auf der sendenden App. In Android 16 wird die Steuerung nun auf die empfangende App verlagert. Entwickler können sich über ihr App-Manifest für eine strenge Intent-Auflösung entscheiden.

Es werden zwei wichtige Änderungen eingeführt:

  1. Explizite Intents müssen mit dem Intent-Filter der Zielkomponente übereinstimmen: Wenn ein Intent explizit auf eine Komponente ausgerichtet ist, muss er mit dem Intent-Filter dieser Komponente übereinstimmen.

  2. Intents ohne Aktion können keinem Intent-Filter entsprechen: Intents, für die keine Aktion angegeben ist, sollten nicht in einen Intent-Filter aufgelöst werden.

Diese Änderungen gelten nur, wenn mehrere Apps beteiligt sind, und haben keine Auswirkungen auf die Verarbeitung von Intents innerhalb einer einzelnen App.

Positiv beeinflussen

Da es sich um eine Opt-in-Funktion handelt, müssen Entwickler sie explizit in ihrem App-Manifest aktivieren, damit sie wirksam wird. Daher beschränkt sich die Wirkung der Funktion auf Apps, deren Entwickler:

  • Sie kennen die Funktion „Safer Intents“ und ihre Vorteile.
  • Sie entscheiden sich aktiv dafür, strengere Methoden für die Intent-Verarbeitung in ihre Apps zu integrieren.

Dieser Opt-in-Ansatz minimiert das Risiko, dass vorhandene Apps, die möglicherweise auf dem aktuellen, weniger sicheren Verhalten bei der Intent-Auflösung basieren, nicht mehr funktionieren.

Die anfänglichen Auswirkungen in Android 16 sind möglicherweise begrenzt, aber die Initiative „Safer Intents“ hat einen Fahrplan für umfassendere Auswirkungen in zukünftigen Android-Releases. Es ist geplant, die strikte Intenterkennung zum Standardverhalten zu machen.

Die Funktion „Sichere Intents“ kann die Sicherheit des Android-Ökosystems erheblich verbessern, da sie es bösartigen Apps erschwert, Sicherheitslücken im Mechanismus zur Intent-Auflösung auszunutzen.

Die Umstellung auf die Opt-out-Funktion und die obligatorische Durchsetzung müssen jedoch sorgfältig verwaltet werden, um potenzielle Kompatibilitätsprobleme mit bestehenden Apps zu beheben.

Implementierung

Entwickler müssen die strengere Intent-Abstimmung explizit über das Attribut intentMatchingFlags in ihrem App-Manifest aktivieren. Hier ist ein Beispiel, in dem die Funktion für die gesamte App aktiviert ist, aber auf einem Empfänger deaktiviert bzw. deaktiviert wurde:

<application android:intentMatchingFlags="enforceIntentFilter">
    <receiver android:name=".MyBroadcastReceiver" android:exported="true" android:intentMatchingFlags="none">
        <intent-filter>
            <action android:name="com.example.MY_CUSTOM_ACTION" />
        </intent-filter>
        <intent-filter>
            <action android:name="com.example.MY_ANOTHER_CUSTOM_ACTION" />
        </intent-filter>
    </receiver>
</application>

Weitere Informationen zu den unterstützten Flags:

Name des Parameters Beschreibung
enforceIntentFilter Erzwingt einen strengeren Abgleich für eingehende Intents
Keine Deaktiviert alle speziellen Abgleichsregeln für eingehende Intents. Wenn Sie mehrere Flags angeben, werden widersprüchliche Werte aufgelöst, indem das Flag „none“ Vorrang erhält.
allowNullAction Die Abgleichsregeln werden gelockert, sodass auch Intents ohne Aktion abgeglichen werden können. Dieses Flag wird in Verbindung mit „enforceIntentFilter“ verwendet, um ein bestimmtes Verhalten zu erzielen.

Testen und Fehler beheben

Wenn die Erzwingung aktiv ist, sollten Apps ordnungsgemäß funktionieren, sofern der Intent-Aufrufer den Intent richtig ausgefüllt hat. Blockierte Intents lösen jedoch Warnmeldungen wie "Intent does not match component's intent filter:" und "Access blocked:" mit dem Tag "PackageManager." aus. Das deutet auf ein potenzielles Problem hin, das sich auf die App auswirken könnte und das behoben werden muss.

Logcat-Filter:

tag=:PackageManager & (message:"Intent does not match component's intent filter:" | message: "Access blocked:")

Datenschutz

Android 16 (API-Level 36) umfasst die folgenden Änderungen in Bezug auf den Datenschutz.

Berechtigung für das lokale Netzwerk

Devices on the LAN can be accessed by any app that has the INTERNET permission. This makes it easy for apps to connect to local devices but it also has privacy implications such as forming a fingerprint of the user, and being a proxy for location.

The Local Network Protections project aims to protect the user's privacy by gating access to the local network behind a new runtime permission.

Release plan

This change will be deployed between two releases, 25Q2 and TBD respectively. It is imperative that developers follow this guidance for 25Q2 and share feedback because these protections will be enforced at a later Android release. Moreover, they will need to update scenarios which depend on implicit local network access by using the following guidance and prepare for user rejection and revocation of the new permission.

Impact

At the current stage, LNP is an opt-in feature which means only the apps that opt in will be affected. The goal of the opt-in phase is for app developers to understand which parts of their app depend on implicit local network access such that they can prepare to permission guard them for the next release.

Apps will be affected if they access the user's local network using:

  • Direct or library use of raw sockets on local network addresses (e.g. mDNS or SSDP service discovery protocol)
  • Use of framework level classes that access the local network (e.g. NsdManager)

Traffic to and from a local network address requires local network access permission. The following table lists some common cases:

App Low Level Network Operation Local Network Permission Required
Making an outgoing TCP connection yes
Accepting incoming TCP connections yes
Sending a UDP unicast, multicast, broadcast yes
Receiving an incoming UDP unicast, multicast, broadcast yes

These restrictions are implemented deep in the networking stack, and thus they apply to all networking APIs. This includes sockets created in native or managed code, networking libraries like Cronet and OkHttp, and any APIs implemented on top of those. Trying to resolve services on the local network (i.e. those with a .local suffix) will require local network permission.

Exceptions to the rules above:

  • If a device's DNS server is on a local network, traffic to or from it (at port 53) doesn't require local network access permission.
  • Applications using Output Switcher as their in-app picker won't need local network permissions (more guidance to come in 2025Q4).

Developer Guidance (Opt-in)

To opt into local network restrictions, do the following:

  1. Flash the device to a build with 25Q2 Beta 3 or later.
  2. Install the app to be tested.
  3. Toggle the Appcompat flag in adb:

    adb shell am compat enable RESTRICT_LOCAL_NETWORK <package_name>
    
  4. Reboot The device

Now your app's access to the local network is restricted and any attempt to access the local network will lead to socket errors. If you are using APIs that perform local network operations outside of your app process (ex: NsdManager), they won't be impacted during the opt-in phase.

To restore access, you must grant your app permission to NEARBY_WIFI_DEVICES.

  1. Ensure the app declares the NEARBY_WIFI_DEVICES permission in its manifest.
  2. Go to Settings > Apps > [Application Name] > Permissions > Nearby devices > Allow.

Now your app's access to the local network should be restored and all your scenarios should work as they did prior to opting the app in.

Once enforcement for local network protection begins, here is how the app network traffic will be impacted.

Permission Outbound LAN Request Outbound/Inbound Internet Request Inbound LAN Request
Granted Works Works Works
Not Granted Fails Works Fails

Use the following command to toggle-off the App-Compat flag

adb shell am compat disable RESTRICT_LOCAL_NETWORK <package_name>

Errors

Errors arising from these restrictions will be returned to the calling socket whenever it invokes send or a send variant to a local network address.

Example errors:

sendto failed: EPERM (Operation not permitted)

sendto failed: ECONNABORTED (Operation not permitted)

Local Network Definition

A local network in this project refers to an IP network that utilizes a broadcast-capable network interface, such as Wi-Fi or Ethernet, but excludes cellular (WWAN) or VPN connections.

The following are considered local networks:

IPv4:

  • 169.254.0.0/16 // Link Local
  • 100.64.0.0/10 // CGNAT
  • 10.0.0.0/8 // RFC1918
  • 172.16.0.0/12 // RFC1918
  • 192.168.0.0/16 // RFC1918

IPv6:

  • Link-local
  • Directly-connected routes
  • Stub networks like Thread
  • Multiple-subnets (TBD)

Additionally, both multicast addresses (224.0.0.0/4, ff00::/8) and the IPv4 broadcast address (255.255.255.255) are classified as local network addresses.

App-eigene Fotos

When prompted for photo and video permissions by an app targeting SDK 36 or higher on devices running Android 16 or higher, users who choose to limit access to selected media will see any photos owned by the app pre-selected in the photo picker. Users can deselect any of these pre-selected items, which will revoke the app's access to those photos and videos.