Özelliklere ve API'lere Genel Bakış

Android 14, geliştiriciler için harika özellikler ve API'ler sunuyor. Aşağıdaki yardım kaynakları, uygulamalarınızdaki özellikler hakkında bilgi edinmenize ve ilgili API'leri kullanmaya başlamanıza yardımcı olur.

Eklenen, değiştirilen ve kaldırılan API'lerin ayrıntılı listesi için API farkı raporunu inceleyin. Eklenen API'lerle ilgili ayrıntılar için Android API referansını ziyaret edin. Android 14 için API düzeyi 34'te eklenen API'leri bulun. Platform değişikliklerinin uygulamalarınızı etkileyebileceği alanlar hakkında bilgi edinmek için Android 14'ü hedefleyen uygulamalar ve tüm uygulamalar için Android 14 davranış değişiklikleri bölümünü inceleyin.

Uluslararası hale getirme

Uygulamaya özgü dil tercihleri

Android 14, Android 13'te (API düzeyi 33) kullanıma sunulan uygulama başına dil özelliklerini aşağıdaki ek özelliklerle genişletir:

  • Uygulamanın localeConfig dosyasını otomatik olarak oluşturma: Android Studio Giraffe Canary 7 ve AGP 8.1.0-alpha07'den itibaren uygulamanızı uygulama başına dil tercihlerini otomatik olarak destekleyecek şekilde yapılandırabilirsiniz. Android Gradle eklentisi, proje kaynaklarınızı temel alarak LocaleConfig dosyasını oluşturur ve nihai manifest dosyasına bu dosyaya referans ekler. Böylece artık dosyayı manuel olarak oluşturmanız veya güncellemeniz gerekmez. AGP, LocaleConfig dosyasına eklenecek yerel ayarları belirlemek için uygulama modüllerinizin res klasörlerindeki kaynakları ve kitaplık modülü bağımlılıklarını kullanır.

  • Uygulamanın localeConfig için dinamik güncellemeler: LocaleManager'deki setOverrideLocaleConfig() ve getOverrideLocaleConfig() yöntemlerini kullanarak uygulamanızın desteklenen diller listesini cihazın sistem ayarlarında dinamik olarak güncelleyin. Bu esnekliği kullanarak bölgeye göre desteklenen diller listesini özelleştirebilir, A/B denemeleri çalıştırabilir veya uygulamanız yerelleştirme için sunucu tarafı push'ları kullanıyorsa güncellenmiş bir yerel ayar listesi sağlayabilirsiniz.

  • Giriş yöntemi düzenleyiciler (IME'ler) için uygulama dili görünürlüğü: IME'ler, mevcut uygulamanın dilini kontrol etmek ve IME dilini bu dille eşleştirmek için getApplicationLocales() yöntemini kullanabilir.

Grammatical Inflection API

3 milyar insan cinsiyete dayalı diller konuşuyor: İsim, fiil, sıfat ve edat gibi dil bilgisi kategorilerinin, konuştuğunuz veya bahsettiğiniz kişilerin ve nesnelerin cinsiyetine göre değiştiği diller. Cinsiyetli dillerin çoğunda, geleneksel olarak varsayılan veya genel cinsiyet olarak eril dil bilgisi cinsiyeti kullanılır.

Kullanıcılara yanlış dil bilgisi cinsiyetiyle hitap etmek (ör. kadınları eril dil bilgisi cinsiyetiyle hitap etmek) performanslarını ve tutumlarını olumsuz yönde etkileyebilir. Buna karşılık, kullanıcının dil bilgisi açısından cinsiyetini doğru yansıtan bir kullanıcı arayüzü, kullanıcı etkileşimini artırabilir ve daha kişiselleştirilmiş ve doğal bir kullanıcı deneyimi sunabilir.

为帮助您针对区分性别的语言构建以用户为中心的界面,Android 14 引入了 Grammatical Inflection API,让您无需重构应用便能添加对语法性别的支持。

Bölgeye özgü tercihler

Regional preferences enable users to personalize temperature units, the first day of the week, and numbering systems. A European living in the United States might prefer temperature units to be in Celsius rather than Fahrenheit and for apps to treat Monday as the beginning of the week instead of the US default of Sunday.

New Android Settings menus for these preferences provide users with a discoverable and centralized location to change app preferences. These preferences also persist through backup and restore. Several APIs and intents—such as getTemperatureUnit and getFirstDayOfWeek— grant your app read access to user preferences, so your app can adjust how it displays information. You can also register a BroadcastReceiver on ACTION_LOCALE_CHANGED to handle locale configuration changes when regional preferences change.

To find these settings, open the Settings app and navigate to System > Languages & input > Regional preferences.

Regional preferences screen in Android system settings.
Temperature options for regional preferences in Android system settings.

Erişilebilirlik

%200'e kadar doğrusal olmayan yazı tipi ölçeklendirme

Starting in Android 14, the system supports font scaling up to 200%, providing low-vision users with additional accessibility options that align with Web Content Accessibility Guidelines (WCAG).

To prevent large text elements on screen from scaling too large, the system applies a nonlinear scaling curve. This scaling strategy means that large text doesn't scale at the same rate as smaller text. Nonlinear font scaling helps preserve the proportional hierarchy between elements of different sizes while mitigating issues with linear text scaling at high degrees (such as text being cut off or text that becomes harder to read due to an extremely large display sizes).

Test your app with nonlinear font scaling

Enable the maximum font size in a device's accessibility settings to test your app.

If you already use scaled pixels (sp) units to define text sizing, then these additional options and scaling improvements are applied automatically to the text in your app. However, you should still perform UI testing with the maximum font size enabled (200%) to ensure that your app applies the font sizes correctly and can accommodate larger font sizes without impacting usability.

To enable 200% font size, follow these steps:

  1. Open the Settings app and navigate to Accessibility > Display size and text.
  2. For the Font size option, tap the plus (+) icon until the maximum font size setting is enabled, as shown in the image that accompanies this section.

Use scaled pixel (sp) units for text-sizes

Remember to always specify text sizes in sp units. When your app uses sp units, Android can apply the user's preferred text size and scale it appropriately.

Don't use sp units for padding or define view heights assuming implicit padding: with nonlinear font scaling sp dimensions might not be proportional, so 4sp + 20sp might not equal 24sp.

Convert scaled pixel (sp) units

Use TypedValue.applyDimension() to convert from sp units to pixels, and use TypedValue.deriveDimension() to convert pixels to sp. These methods apply the appropriate nonlinear scaling curve automatically.

Avoid hardcoding equations using Configuration.fontScale or DisplayMetrics.scaledDensity. Because font scaling is nonlinear, the scaledDensity field is no longer accurate. The fontScale field should be used for informational purposes only because fonts are no longer scaled with a single scalar value.

Use sp units for lineHeight

Always define android:lineHeight using sp units instead of dp, so the line height scales along with your text. Otherwise, if your text is sp but your lineHeight is in dp or px, it doesn't scale and looks cramped. TextView automatically corrects the lineHeight so that your intended proportions are preserved, but only if both textSize and lineHeight are defined in sp units.

Kamera ve medya içerikleri

Resimler için Ultra HDR

标准动态范围 (SDR) 与高动态范围 (HDR) 图片质量对比示意图。

Android 14 新增了对高动态范围 (HDR) 图片的支持,可在拍摄照片时保留更多来自传感器的信息,从而实现鲜艳的色彩和更高的对比度。Android 使用 Ultra HDR 格式,该格式与 JPEG 图片完全向后兼容,可让应用与 HDR 图片无缝互操作,并根据需要以标准动态范围 (SDR) 显示这些图片。

当您的应用选择为其 activity 窗口使用 HDR 界面(通过清单条目或通过在运行时调用 Window.setColorMode())时,框架会自动在界面中以 HDR 格式渲染这些图片。您还可以在受支持的设备上拍摄压缩的 Ultra HDR 静态图片。从传感器中恢复的颜色越多,后期编辑的灵活性就越高。与 Ultra HDR 图片关联的 Gainmap 可用于使用 OpenGL 或 Vulkan 渲染这些图片。

Kamera uzantılarında yakınlaştırma, odaklama, son görüntü ve daha fazlası

Android 14 升级并改进了相机扩展程序,让应用能够处理更长的处理时间,从而支持在受支持的设备上使用计算密集型算法(例如弱光摄影)来改善图片。这些功能可让用户在使用相机扩展功能时获得更出色的体验。这些改进的示例包括:

Sensör içi yakınlaştırma

CameraCharacteristics içindeki REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW içeriyorsa uygulamanız, akış kullanım alanı CameraMetadata.SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW olarak ayarlanmış bir RAW hedefi içeren CaptureRequest kullanarak kırpılmış bir RAW akışına tam görüş alanı ile aynı pikselleri vermek için gelişmiş sensör özelliklerini kullanabilir. Güncellenen kamera, istek geçersiz kılma denetimlerini uygulayarak kullanıcılara diğer kamera kontrolleri hazır olmadan önce bile yakınlaştırma kontrolü sunar.

Kayıpsız USB ses

Android 14 支持无损音频格式,可通过 USB 有线耳机提供发烧友级体验。您可以查询 USB 设备的首选混音器属性,注册监听器以监听首选混音器属性的更改,以及使用 AudioMixerAttributes 类配置混音器属性。此类表示音频混音器的格式,例如声道掩码、采样率和行为。该类允许直接发送音频,而无需混音、调节音量或处理效果。

Geliştirici üretkenliği ve araçları

Kimlik Bilgisi Yöneticisi

Android 14 adds Credential Manager as a platform API, with additional support back to Android 4.4 (API level 19) devices through a Jetpack Library using Google Play services. Credential Manager aims to make sign-in easier for users with APIs that retrieve and store credentials with user-configured credential providers. Credential Manager supports multiple sign-in methods, including username and password, passkeys, and federated sign-in solutions (such as Sign-in with Google) in a single API.

Passkeys provide many advantages. For example, passkeys are built on industry standards, can work across different operating systems and browser ecosystems, and can be used with both websites and apps.

For more information, see the Credential Manager and passkeys documentation and the blogpost about Credential Manager and passkeys.

ve geri yükleme

Health Connect is an on-device repository for user health and fitness data. It allows users to share data between their favorite apps, with a single place to control what data they want to share with these apps.

On devices running Android versions prior to Android 14, Health Connect is available to download as an app on the Google Play store. Starting with Android 14, Health Connect is part of the platform and receives updates through Google Play system updates without requiring a separate download. With this, Health Connect can be updated frequently, and your apps can rely on Health Connect being available on devices running Android 14 or higher. Users can access Health Connect from the Settings in their device, with privacy controls integrated into the system settings.

Users can get started using Health Connect without a separate app download on devices running Android 14 or higher.
Users can control which apps have access to their health and fitness data through system settings.

Health Connect includes several new features in Android 14, such as exercise routes, allowing users to share a route of their workout which can be visualized on a map. A route is defined as a list of locations saved within a window of time, and your app can insert routes into exercise sessions, tying them together. To ensure that users have complete control over this sensitive data, users must allow sharing individual routes with other apps.

For more information, see the Health Connection documentation and the blogpost on What's new in Android Health.

OpenJDK 17 güncellemeleri

Android 14 continues the work of refreshing Android's core libraries to align with the features in the latest OpenJDK LTS releases, including both library updates and Java 17 language support for app and platform developers.

The following features and improvements are included:

  • Updated approximately 300 java.base classes to Java 17 support.
  • Text Blocks, which introduce multi-line string literals to the Java programming language.
  • Pattern Matching for instanceof, which allows an object to be treated as having a specific type in an instanceof without any additional variables.
  • Sealed classes, which allow you restrict which classes and interfaces can extend or implement them.

Thanks to Google Play system updates (Project Mainline), over 600 million devices are enabled to receive the latest Android Runtime (ART) updates that include these changes. This is part of our commitment to give apps a more consistent, secure environment across devices, and to deliver new features and capabilities to users independent of platform releases.

Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Uygulama mağazalarıyla ilgili iyileştirmeler

Android 14 引入了多个 PackageInstaller API,可帮助应用商店改善其用户体验。

下载之前请求批准安装

安装或更新应用可能需要用户批准。例如,当使用 REQUEST_INSTALL_PACKAGES 权限的安装程序尝试安装新应用时。在之前的 Android 版本中,只有在将 APK 写入安装会话并且提交会话后,应用商店才能请求用户批准。

从 Android 14 开始,requestUserPreapproval() 方法可让安装程序在提交安装会话之前请求用户批准。此项改进可让应用商店将任何 APK 的下载操作推迟到用户批准安装之后。此外,用户批准安装后,应用商店可以在后台下载并安装应用,而不会干扰用户。

承担未来更新的责任

借助 setRequestUpdateOwnership() 方法,安装程序可以向系统表明它打算负责将被安装的应用未来的更新。此 capability 可实现更新所有权强制执行,即仅允许更新所有者为应用安装自动更新。更新所有权强制执行有助于确保用户仅收到来自预期应用商店的更新。

任何其他安装程序(包括使用 INSTALL_PACKAGES 权限的安装程序)都必须获得用户的明确批准,才能安装更新。如果用户决定继续从其他来源安装更新,则会失去更新所有权。

在干扰较少的时段更新应用

应用商店通常希望避免更新正在使用的应用,因为这会导致应用正在运行的进程被终止,而这可能会中断用户正在执行的操作。

从 Android 14 开始,InstallConstraints API 让安装程序可以确保其应用更新在适当的时机进行。例如,应用商店可以调用 commitSessionAfterInstallConstraintsAreMet() 方法来确保仅在用户不再与相应应用互动时才进行更新。

无缝安装可选拆分

借助拆分 APK,应用的功能可以通过单独的 APK 文件提供,而不是以单体式 APK 的形式提供。借助拆分 APK,应用商店可以优化不同应用组件的提供。例如,应用商店可能会根据目标设备的属性进行优化。自在 API 级别 22 中引入以来,PackageInstaller API 一直支持拆分。

在 Android 14 中,setDontKillApp() 方法可让安装程序指明在安装新的拆分项时应用的运行进程不应终止。应用商店可以使用此功能,在用户使用应用时无缝安装应用的新功能。

Uygulama meta verileri paketleri

Android 14'ten itibaren Android paket yükleyici, Google Play gibi uygulama mağazası sayfalarına dahil edilecek uygulama meta verilerini (ör. veri güvenliği uygulamaları) belirtmenize olanak tanır.

Kullanıcıların cihaz ekran görüntüsü aldığını algılama

为了打造更加标准化的屏幕截图检测体验,Android 14 引入了可保护隐私的屏幕截图检测 API。借助此 API,应用可以按 activity 注册回调。如果用户在该 activity 可见时截取屏幕截图,系统会调用这些回调并通知用户。

Kullanıcı deneyimi

Paylaşım sayfasındaki özel işlemler ve iyileştirilmiş sıralama

Android 14, sistem paylaşım sayfasını özel uygulama işlemlerini ve kullanıcılar için daha bilgilendirici önizleme sonuçlarını destekleyecek şekilde günceller.

Özel işlem ekleme

Android 14 ile uygulamanız, çağırdığı sistem paylaşım sayfasına özel işlemler ekleyebilir.

Paylaşım sayfasındaki özel işlemlerin ekran görüntüsü.

Doğrudan Paylaşım hedeflerinin sıralamasını iyileştirme

Android 14, kullanıcıya daha faydalı sonuçlar sunmak için doğrudan paylaşım hedeflerinin sıralamasını belirlemek amacıyla uygulamalardan daha fazla sinyal kullanır. Sıralama için en faydalı sinyali sağlamak üzere doğrudan paylaşım hedeflerinizin sıralamalarına ilişkin yönergeleri uygulayın. İletişim uygulamaları, giden ve gelen mesajlar için kısayol kullanımını da bildirebilir.

Paylaşım sayfasındaki Doğrudan Paylaşım satırı (1 ile gösterilmiştir)

Tahmine dayalı geri hareketi için yerleşik ve özel animasyon desteği

Video: Tahmin edilen geri gitme animasyonları

Android 13, geliştirici seçeneğiyle birlikte tahmine dayalı ana sayfaya geri gitme animasyonunu kullanıma sundu. Geliştirici seçeneği etkinleştirilmiş desteklenen bir uygulamada geri kaydırılırken, geri hareketinin uygulamadan çıkıp ana ekrana döndüğünü belirten bir animasyon gösterilir.

Android 14, Tahmini Geri özelliği için birden fazla iyileştirme ve yeni rehberlik içerir:

Bu Android 14 önizleme sürümünde, Tahmini Geri Yükleme'nin tüm özellikleri geliştirici seçeneği olarak sunulur. Uygulamanızı tahmini geriye taşıma ile ilgili geliştirici kılavuzunu ve özel uygulama içi geçişler oluşturma ile ilgili geliştirici kılavuzunu inceleyin.

Büyük ekranlı cihaz üreticilerinin uygulama başına geçersiz kılmaları

Per-app overrides enable device manufacturers to change the behavior of apps on large screen devices. For example, the FORCE_RESIZE_APP override instructs the system to resize the app to fit display dimensions (avoiding size compatibility mode) even if resizeableActivity="false" is set in the app manifest.

Overrides are intended to improve the user experience on large screens.

New manifest properties enable you to disable some device manufacturer overrides for your app.

Büyük ekran kullanıcılarının uygulama başına geçersiz kılmaları

Per-app overrides change the behavior of apps on large screen devices. For example, the OVERRIDE_MIN_ASPECT_RATIO_LARGE device manufacturer override sets the app aspect ratio to 16:9 regardless of the app's configuration.

Android 14 QPR1 enables users to apply per‑app overrides by means of a new settings menu on large screen devices.

Uygulama ekran paylaşımı

借助应用界面共享功能,用户可以在录制屏幕内容时共享应用窗口,而不是整个设备屏幕。

在应用屏幕共享模式下,状态栏、导航栏、通知和其他系统界面元素会从共享显示屏中排除。系统只会分享所选应用的内容。

应用屏幕共享功能可让用户运行多个应用,但将内容共享限制为单个应用,从而提高工作效率并保护隐私。

Pixel 8 Pro'da Gboard'da LLM destekli Akıllı Yanıt

On Pixel 8 Pro devices with the December Feature Drop, developers can try out higher-quality smart replies in Gboard powered by on-device Large Language Models (LLMs) running on Google Tensor.

This feature is available as a limited preview for US English in WhatsApp, Line, and KakaoTalk. It requires using a Pixel 8 Pro device with Gboard as your keyboard.

To try it out, first enable the feature in Settings > Developer Options > AiCore Settings > Enable Aicore Persistent.

Next, open a conversation in a supported app to see LLM-powered Smart Reply in Gboard's suggestion strip in response to incoming messages.

Gboard utilizes on-device LLMs to provide higher-quality smart replies.

Grafik

Yollar sorgulanabilir ve enterpolasyon yapılabilir

Android'in Path API'si, vektör grafikleri oluşturmaya ve oluşturmaya yönelik güçlü ve esnek bir mekanizmadır. Bir yolu çizme veya doldurma, çizgi segmentlerinden veya ikinci dereceden ya da kübik eğrilerden yol oluşturma, daha da karmaşık şekiller elde etmek için boole işlemleri veya bunların tümünü eş zamanlı olarak gerçekleştirme yeteneğine sahip. Bunun bir sınırlaması, Yol nesnesinde gerçekte neyin olduğunu bulma yeteneğidir. Nesnenin iç kısımları, oluşturulduktan sonra arayanlar için opak olur.

Path oluşturmak için moveTo(), lineTo() ve cubicTo() gibi yöntemleri çağırarak yol segmentleri ekleyebilirsiniz. Ancak bu yolda segmentlerin ne olduğunu sormanın bir yolu olmadığından, bu bilgileri oluşturma sırasında saklamanız gerekir.

Android 14'ten itibaren, içinde ne olduğunu öğrenmek için yolları sorgulayabilirsiniz. Öncelikle, Path.getPathIterator API'yi kullanarak bir PathIterator nesnesi almanız gerekir:

Kotlin

val path = Path().apply {
    moveTo(1.0f, 1.0f)
    lineTo(2.0f, 2.0f)
    close()
}
val pathIterator = path.pathIterator

Java

Path path = new Path();
path.moveTo(1.0F, 1.0F);
path.lineTo(2.0F, 2.0F);
path.close();
PathIterator pathIterator = path.getPathIterator();

Daha sonra, segmentleri tek tek güncellemek ve her bir segment için gerekli tüm verileri almak üzere PathIterator öğesini çağırabilirsiniz. Bu örnekte, verileri sizin için paketleyen PathIterator.Segment nesneleri kullanılmaktadır:

Kotlin

for (segment in pathIterator) {
    println("segment: ${segment.verb}, ${segment.points}")
}

Java

while (pathIterator.hasNext()) {
    PathIterator.Segment segment = pathIterator.next();
    Log.i(LOG_TAG, "segment: " + segment.getVerb() + ", " + segment.getPoints());
}

PathIterator, nokta verilerini tutmak için bir arabellek iletebileceğiniz, next()'un ayırt etmeyen bir sürümüne de sahiptir.

Path verilerini sorgulamanın önemli kullanım alanlarından biri de kesme noktasıdır. Örneğin, iki farklı yol arasında animasyon (veya morph) oluşturmak isteyebilirsiniz. Bu kullanım alanını daha da basitleştirmek için Android 14, Path üzerinde interpolate() yöntemini de içerir. İki yolun aynı dahili yapıya sahip olduğu varsayıldığında interpolate() yöntemi, ara değer alınan bu sonuçla yeni bir Path oluşturur. Bu örnek, şekli path ile otherPath arasında yarı yolda olan (0,5 değerinin doğrusal bir kesişimi) bir yol döndürür:

Kotlin

val interpolatedResult = Path()
if (path.isInterpolatable(otherPath)) {
    path.interpolate(otherPath, .5f, interpolatedResult)
}

Java

Path interpolatedResult = new Path();
if (path.isInterpolatable(otherPath)) {
    path.interpolate(otherPath, 0.5F, interpolatedResult);
}

Jetpack graphics-path kitaplığı, Android'in önceki sürümleri için de benzer API'leri etkinleştirir.

Köşe ve parça gölgelendiricileri içeren özel ağlar

Android has long supported drawing triangle meshes with custom shading, but the input mesh format has been limited to a few predefined attribute combinations. Android 14 adds support for custom meshes, which can be defined as triangles or triangle strips, and can, optionally, be indexed. These meshes are specified with custom attributes, vertex strides, varying, and vertex and fragment shaders written in AGSL.

The vertex shader defines the varyings, such as position and color, while the fragment shader can optionally define the color for the pixel, typically by using the varyings created by the vertex shader. If color is provided by the fragment shader, it is then blended with the current Paint color using the blend mode selected when drawing the mesh. Uniforms can be passed into the fragment and vertex shaders for additional flexibility.

Canvas için donanım arabelleği oluşturucu

协助使用 Android 的 Canvas API 通过 硬件加速至 HardwareBuffer、Android 14 引入了 HardwareBufferRenderer。如果您的用例涉及通过 SurfaceControl 与系统合成器通信以实现低延迟绘制,此 API 特别有用。