सुविधाओं और एपीआई के बारे में खास जानकारी

Android 14 में डेवलपर के लिए कई बेहतरीन सुविधाएं और एपीआई उपलब्ध हैं. यहां दी गई मदद से, आपको अपने ऐप्लिकेशन के लिए उपलब्ध सुविधाओं के बारे में जानने और उनसे जुड़े एपीआई का इस्तेमाल शुरू करने में मदद मिलेगी.

जोड़े गए, बदले गए, और हटाए गए एपीआई की पूरी सूची देखने के लिए, एपीआई में हुए बदलावों की जानकारी देने वाली रिपोर्ट पढ़ें. जोड़े गए एपीआई के बारे में ज़्यादा जानने के लिए, Android API रेफ़रंस पर जाएं. Android 14 के लिए, एपीआई लेवल 34 में जोड़े गए एपीआई देखें. जिन क्षेत्रों में प्लैटफ़ॉर्म में हुए बदलावों से आपके ऐप्लिकेशन पर असर पड़ सकता है उनके बारे में जानने के लिए, Android 14 में हुए व्यवहार से जुड़े बदलावों के बारे में ज़रूर जानें. ये बदलाव Android 14 को टारगेट करने वाले ऐप्लिकेशन के लिए और सभी ऐप्लिकेशन के लिए किए गए हैं.

इंटरनैशनलाइज़ेशन

हर ऐप्लिकेशन के हिसाब से पसंद की भाषा

Android 14 expands on the per-app language features that were introduced in Android 13 (API level 33) with these additional capabilities:

  • Automatically generate an app's localeConfig: Starting with Android Studio Giraffe Canary 7 and AGP 8.1.0-alpha07, you can configure your app to support per-app language preferences automatically. Based on your project resources, the Android Gradle plugin generates the LocaleConfig file and adds a reference to it in the final manifest file, so you no longer have to create or update the file manually. AGP uses the resources in the res folders of your app modules and any library module dependencies to determine the locales to include in the LocaleConfig file.

  • Dynamic updates for an app's localeConfig: Use the setOverrideLocaleConfig() and getOverrideLocaleConfig() methods in LocaleManager to dynamically update your app's list of supported languages in the device's system settings. Use this flexibility to customize the list of supported languages per region, run A/B experiments, or provide an updated list of locales if your app utilizes server-side pushes for localization.

  • App language visibility for input method editors (IMEs): IMEs can utilize the getApplicationLocales() method to check the language of the current app and match the IME language to that language.

Grammatical Inflection API

दुनिया भर में 3 अरब लोग लिंग के हिसाब से अलग-अलग तरह से इस्तेमाल होने वाली भाषाएं बोलते हैं. इन भाषाओं में, व्याकरण की कैटगरी, जैसे कि संज्ञा, क्रिया, विशेषण, और प्रीपोज़िशन, उन लोगों और ऑब्जेक्ट के लिंग के हिसाब से बदलते हैं जिनके बारे में बात की जा रही है. आम तौर पर, लैंगिक भेद वाली कई भाषाओं में, मर्दों के लिए इस्तेमाल होने वाले व्याकरण के लिंग को डिफ़ॉल्ट या सामान्य लिंग के तौर पर इस्तेमाल किया जाता है.

उपयोगकर्ताओं को गलत व्याकरण के हिसाब से संबोधित करने से, उनकी परफ़ॉर्मेंस और व्यवहार पर बुरा असर पड़ सकता है. जैसे, महिलाओं को पुल्लिग व्याकरण के हिसाब से संबोधित करना. इसके उलट, यूज़र इंटरफ़ेस (यूआई) में ऐसी भाषा का इस्तेमाल करने से, उपयोगकर्ता के व्याकरण के हिसाब से लिंग की जानकारी सही तरीके से दिखती है. इससे उपयोगकर्ता जुड़ाव बढ़ता है और उपयोगकर्ता को ज़्यादा पसंद के मुताबिक और स्वाभाविक अनुभव मिलता है.

लिंग के आधार पर बोली जाने वाली भाषाओं के लिए, उपयोगकर्ता के हिसाब से यूज़र इंटरफ़ेस (यूआई) बनाने में आपकी मदद करने के लिए, Android 14 में Grammatical Inflection API को जोड़ा गया है. इसकी मदद से, अपने ऐप्लिकेशन को फिर से बनाने के बिना, व्याकरण के हिसाब से लिंग के लिए सहायता जोड़ी जा सकती है.

जगह के हिसाब से प्राथमिकताएं

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.

सुलभता

फ़ॉन्ट को 200% तक नॉन-लीनियर तरीके से बड़ा करना

Android 14 से, सिस्टम में फ़ॉन्ट को 200% तक बड़ा किया जा सकता है. इससे कम दृष्टि वाले उपयोगकर्ताओं को, वेब कॉन्टेंट ऐक्सेसेबिलिटी से जुड़े दिशा-निर्देशों (डब्ल्यूसीएजी) के मुताबिक, सुलभता से जुड़े अन्य विकल्प मिलते हैं.

स्क्रीन पर मौजूद टेक्स्ट एलिमेंट का साइज़ बहुत बड़ा होने से रोकने के लिए, सिस्टम एक अरेखीय स्केलिंग कर्व लागू करता है. स्केलिंग की इस रणनीति का मतलब है कि बड़े टेक्स्ट छोटे टेक्स्ट की दर को स्केल नहीं करता. नॉनलाइनर फ़ॉन्ट स्केलिंग की मदद से, अलग-अलग साइज़ के एलिमेंट के बीच, अनुपात के हिसाब से हैरारकी बनाए रखने में मदद मिलती है. साथ ही, ज़्यादा डिग्री पर लीनियर टेक्स्ट स्केलिंग से जुड़ी समस्याओं को कम करने में भी मदद मिलती है. जैसे, टेक्स्ट का काटा जाना या बहुत बड़े डिसप्ले साइज़ की वजह से टेक्स्ट को पढ़ने में मुश्किल होना.

नॉन-लीनियर फ़ॉन्ट स्केलिंग की मदद से अपने ऐप्लिकेशन की जांच करना

अपने ऐप्लिकेशन की जांच करने के लिए, डिवाइस की सुलभता सेटिंग में जाकर, फ़ॉन्ट का सबसे बड़ा साइज़ चालू करें.

अगर टेक्स्ट का साइज़ तय करने के लिए, स्केल किए गए पिक्सल (sp) यूनिट का इस्तेमाल पहले से किया जा रहा है, तो ये अतिरिक्त विकल्प और स्केलिंग सुधार अपने-आप टेक्स्ट दिखाई देगा. हालांकि, आपको अभी भी फ़ॉन्ट साइज़ चालू (200%) किया जा सकता है, ताकि यह पक्का किया जा सके कि आपके ऐप्लिकेशन पर फ़ॉन्ट साइज़ लागू हों साथ ही, ये टूल बड़े साइज़ के फ़ॉन्ट में भी फ़िट हो सकते हैं. इससे, इस्तेमाल करने की सुविधा पर कोई असर नहीं पड़ता.

200% फ़ॉन्ट साइज़ चालू करने के लिए, यह तरीका अपनाएं:

  1. सेटिंग ऐप्लिकेशन खोलें और सुलभता > डिसप्ले का साइज़ और टेक्स्ट पर जाएं.
  2. फ़ॉन्ट का साइज़ विकल्प के लिए, प्लस (+) आइकॉन पर तब तक टैप करें, जब तक फ़ॉन्ट के सबसे बड़े साइज़ की सेटिंग चालू न हो जाए. इस सेक्शन में दी गई इमेज में यह तरीका दिखाया गया है.

टेक्स्ट के साइज़ के लिए, स्केल किए गए पिक्सल (sp) यूनिट का इस्तेमाल करना

याद रखें कि हमेशा sp यूनिट में टेक्स्ट के साइज़ की जानकारी दें. टास्क कब शुरू होगा आपका ऐप्लिकेशन एसपी यूनिट का इस्तेमाल करता है, तो Android उपयोगकर्ता के टेक्स्ट का पसंदीदा साइज़ लागू कर सकता है और उसे ज़रूरत के हिसाब से स्केल करें.

पैडिंग के लिए sp यूनिट का इस्तेमाल न करें या पैडिंग के लिए व्यू की ऊंचाई तय न करें: नॉन-लाइनर फ़ॉन्ट स्केलिंग के साथ, हो सकता है कि sp डाइमेंशन का अनुपात न हो. इसलिए, हो सकता है कि 4sp + 20sp का योग 24sp न हो.

स्केल की गई पिक्सल (sp) इकाइयों को बदलना

sp यूनिट को पिक्सल में बदलने के लिए, TypedValue.applyDimension() का इस्तेमाल करें. साथ ही, पिक्सल को sp में बदलने के लिए, TypedValue.deriveDimension() का इस्तेमाल करें. ये तरीके, स्केलिंग के लिए सही नॉन-लाइनर कर्व को अपने-आप लागू करते हैं.

इनका इस्तेमाल करके हार्डकोडिंग समीकरण से बचें Configuration.fontScale या DisplayMetrics.scaledDensity. फ़ॉन्ट स्केलिंग, रेखीय नहीं होती. इसलिए, scaledDensity फ़ील्ड अब सटीक नहीं है. fontScale फ़ील्ड का इस्तेमाल सिर्फ़ जानकारी देने के लिए किया जाना चाहिए, क्योंकि फ़ॉन्ट अब एक स्केलर वैल्यू के साथ स्केल नहीं किए जाते.

लाइन की ऊंचाई के लिए एसपी इकाइयों का इस्तेमाल करें

android:lineHeight की वैल्यू हमेशा डीपी के बजाय sp में दें, ताकि लाइन की ऊंचाई आपके टेक्स्ट के साथ स्केल हो सके. अगर आपका टेक्स्ट sp में है, लेकिन lineHeight dp या px में है, तो टेक्स्ट का स्केल नहीं होता और वह छोटा दिखता है. TextView, lineHeight को अपने-आप ठीक करता है, ताकि आपके तय किए गए अनुपात बरकरार रहें. हालांकि, ऐसा सिर्फ़ तब होता है, जब textSize और lineHeight, दोनों को sp इकाइयों में तय किया गया हो.

कैमरा और मीडिया

इमेज के लिए अल्ट्रा एचडीआर

An illustration of Standard Dynamic Range (SDR) versus High Dynamic Range (HDR) image quality.

Android 14 adds support for High Dynamic Range (HDR) images that retain more of the information from the sensor when taking a photo, which enables vibrant colors and greater contrast. Android uses the Ultra HDR format, which is fully backward compatible with JPEG images, allowing apps to seamlessly interoperate with HDR images, displaying them in Standard Dynamic Range (SDR) as needed.

Rendering these images in the UI in HDR is done automatically by the framework when your app opts in to using HDR UI for its Activity Window, either through a manifest entry or at runtime by calling Window.setColorMode(). You can also capture compressed Ultra HDR still images on supported devices. With more colors recovered from the sensor, editing in post can be more flexible. The Gainmap associated with Ultra HDR images can be used to render them using OpenGL or Vulkan.

कैमरे के एक्सटेंशन में ज़ूम करने, फ़ोकस करने, पोस्टव्यू करने वगैरह की सुविधा

Android 14 upgrades and improves camera extensions, allowing apps to handle longer processing times, which enables improved images using compute-intensive algorithms like low-light photography on supported devices. These features give users an even more robust experience when using camera extension capabilities. Examples of these improvements include:

इन-सेंसर ज़ूम

When REQUEST_AVAILABLE_CAPABILITIES_STREAM_USE_CASE in CameraCharacteristics contains SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW, your app can use advanced sensor capabilities to give a cropped RAW stream the same pixels as the full field of view by using a CaptureRequest with a RAW target that has stream use case set to CameraMetadata.SCALER_AVAILABLE_STREAM_USE_CASES_CROPPED_RAW. By implementing the request override controls, the updated camera gives users zoom control even before other camera controls are ready.

बिना डेटा लॉस वाला यूएसबी ऑडियो

Android 14 gains support for lossless audio formats for audiophile-level experiences over USB wired headsets. You can query a USB device for its preferred mixer attributes, register a listener for changes in preferred mixer attributes, and configure mixer attributes using the AudioMixerAttributes class. This class represents the format, such as channel mask, sample rate, and behavior of the audio mixer. The class allows for audio to be sent directly, without mixing, volume adjustment, or processing effects.

डेवलपर की प्रॉडक्टिविटी और टूल

Credential Manager

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.

Health Connect

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 के अपडेट

Android 14 में, Android की मुख्य लाइब्रेरी को अपडेट करने की प्रोसेस जारी है, ताकि इसे OpenJDK LTS के नए वर्शन की सुविधाओं के साथ अलाइन किया जा सके. इसमें, ऐप्लिकेशन और प्लैटफ़ॉर्म डेवलपर के लिए, लाइब्रेरी के अपडेट और Java 17 भाषा की सहायता, दोनों शामिल हैं.

इसमें ये सुविधाएं और सुधार शामिल हैं:

  • करीब 300 java.base क्लास को Java 17 के साथ काम करने के लिए अपडेट किया गया.
  • टेक्स्ट ब्लॉक, जो Java प्रोग्रामिंग लैंग्वेज में मल्टी-लाइन स्ट्रिंग लिटरल का इस्तेमाल करते हैं.
  • instanceof के लिए पैटर्न मैचिंग, जिसकी मदद से किसी ऑब्जेक्ट को instanceof में किसी खास टाइप के तौर पर माना जा सकता है. इसके लिए, किसी और वैरिएबल की ज़रूरत नहीं होती.
  • सील की गई क्लास, जिनकी मदद से यह तय किया जा सकता है कि कौनसी क्लास और इंटरफ़ेस उन्हें एक्सटेंड या लागू कर सकते हैं.

Google Play के सिस्टम अपडेट (Project Mainline) की मदद से, 600 करोड़ से ज़्यादा डिवाइसों पर Android Runtime (ART) के नए अपडेट मिल सकते हैं. इन अपडेट में ये बदलाव शामिल हैं. हम ऐप्लिकेशन को सभी डिवाइसों पर एक जैसा और सुरक्षित माहौल देने के लिए प्रतिबद्ध हैं. साथ ही, हम प्लैटफ़ॉर्म के रिलीज़ से अलग, उपयोगकर्ताओं को नई सुविधाएं और क्षमताएं देने के लिए भी काम कर रहे हैं.

Java और OpenJDK, Oracle और/या इससे जुड़ी हुई कंपनियों के ट्रेडमार्क या रजिस्टर किए हुए ट्रेडमार्क हैं.

ऐप्लिकेशन स्टोर के लिए सुधार

Android 14 में कई PackageInstaller एपीआई जोड़े गए हैं. इनकी मदद से, ऐप्लिकेशन स्टोर अपने उपयोगकर्ताओं के अनुभव को बेहतर बना सकते हैं.

डाउनलोड करने से पहले, इंस्टॉल करने की अनुमति का अनुरोध करना

किसी ऐप्लिकेशन को इंस्टॉल या अपडेट करने के लिए, उपयोगकर्ता की अनुमति लेनी पड़ सकती है. उदाहरण के लिए, जब कोई इंस्टॉलर REQUEST_INSTALL_PACKAGES अनुमति का इस्तेमाल करके नया ऐप्लिकेशन इंस्टॉल करने की कोशिश करता है. Android के पुराने वर्शन में, ऐप्लिकेशन स्टोर सिर्फ़ इसके बाद उपयोगकर्ता की अनुमति का अनुरोध कर सकते हैं, जब APK, इंस्टॉल सेशन में लिखे जाते हैं और सेशन पूरा हो जाता है.

Android 14 से, requestUserPreapproval() तरीके की मदद से इंस्टॉलर, इंस्टॉलेशन सेशन को शुरू करने से पहले उपयोगकर्ता की अनुमति मांग सकते हैं. इस सुधार की मदद से, ऐप स्टोर किसी भी APK को तब तक डाउनलोड नहीं करेगा, जब तक उपयोगकर्ता ने इंस्टॉल करने की अनुमति नहीं दी है. इसके अलावा, जब कोई उपयोगकर्ता ऐप्लिकेशन इंस्टॉल करने की अनुमति देता है, तो ऐप्लिकेशन स्टोर, उपयोगकर्ता को परेशान किए बिना बैकग्राउंड में ऐप्लिकेशन को डाउनलोड और इंस्टॉल कर सकता है.

आने वाले समय में होने वाले अपडेट की ज़िम्मेदारी का दावा करना

setRequestUpdateOwnership() तरीके से, इंस्टॉलर को सिस्टम को यह बताने की अनुमति मिलती है कि वह इंस्टॉल किए जा रहे ऐप्लिकेशन के आने वाले समय में होने वाले अपडेट के लिए ज़िम्मेदार है. इस सुविधा से, अपडेट के मालिकाना हक को लागू करने की सुविधा चालू होती है. इसका मतलब है कि ऐप्लिकेशन में अपने-आप अपडेट होने की सुविधा को सिर्फ़ अपडेट के मालिक के पास इंस्टॉल करने की अनुमति होती है. अपडेट के मालिकाना हक को लागू करने की सुविधा से यह पक्का करने में मदद मिलती है कि उपयोगकर्ताओं को सिर्फ़ उस ऐप्लिकेशन स्टोर से अपडेट मिलें जिस पर ऐप्लिकेशन उपलब्ध है.

अपडेट इंस्टॉल करने के लिए, किसी भी इंस्टॉलर को उपयोगकर्ता की साफ़ तौर पर अनुमति लेनी होगी. इसमें, INSTALL_PACKAGES अनुमति का इस्तेमाल करने वाले इंस्टॉलर भी शामिल हैं. अगर कोई उपयोगकर्ता किसी दूसरे सोर्स से अपडेट करने का फ़ैसला करता है, तो अपडेट का मालिकाना हक खत्म हो जाता है.

ऐप्लिकेशन को कम रुकावट वाले समय पर अपडेट करना

आम तौर पर, ऐप्लिकेशन स्टोर किसी ऐसे ऐप्लिकेशन को अपडेट नहीं करना चाहते जो इस्तेमाल में है. ऐसा इसलिए, क्योंकि इससे ऐप्लिकेशन की चल रही प्रोसेस बंद हो जाती हैं. इससे, उपयोगकर्ता के काम में रुकावट आ सकती है.

Android 14 से, InstallConstraints एपीआई की मदद से, ऐप्लिकेशन इंस्टॉल करने वाले लोग यह पक्का कर सकते हैं कि उनके ऐप्लिकेशन सही समय पर अपडेट हों. उदाहरण के लिए, कोई ऐप्लिकेशन स्टोर, commitSessionAfterInstallConstraintsAreMet() तरीके का इस्तेमाल करके यह पक्का कर सकता है कि अपडेट सिर्फ़ तब लागू किया जाए, जब उपयोगकर्ता उस ऐप्लिकेशन का इस्तेमाल न कर रहा हो.

आसानी से वैकल्पिक स्प्लिट इंस्टॉल करना

स्प्लिट APK की मदद से, किसी ऐप्लिकेशन की सुविधाओं को एक ही APK के बजाय अलग-अलग APK फ़ाइलों में डिलीवर किया जा सकता है. अलग-अलग APK की मदद से, ऐप्लिकेशन स्टोर अलग-अलग ऐप्लिकेशन कॉम्पोनेंट की डिलीवरी को ऑप्टिमाइज़ कर सकते हैं. उदाहरण के लिए, ऐप्लिकेशन स्टोर, टारगेट किए गए डिवाइस की प्रॉपर्टी के आधार पर ऑप्टिमाइज़ हो सकते हैं. PackageInstaller एपीआई, एपीआई लेवल 22 में लॉन्च होने के बाद से ही, स्प्लिट की सुविधा के साथ काम करता है.

Android 14 में, setDontKillApp() तरीके की मदद से इंस्टॉलर यह बता सकता है कि नए स्प्लिट इंस्टॉल होने पर, ऐप्लिकेशन की चल रही प्रोसेस को बंद नहीं किया जाना चाहिए. ऐप्लिकेशन स्टोर इस सुविधा का इस्तेमाल करके, उपयोगकर्ता के ऐप्लिकेशन इस्तेमाल करते समय, ऐप्लिकेशन की नई सुविधाओं को आसानी से इंस्टॉल कर सकते हैं.

ऐप्लिकेशन के मेटाडेटा बंडल

Starting in Android 14, the Android package installer lets you specify app metadata, such as data safety practices, to include on app store pages such as Google Play.

यह पता लगाना कि उपयोगकर्ता डिवाइस के स्क्रीनशॉट कब लेते हैं

To create a more standardized experience for detecting screenshots, Android 14 introduces a privacy-preserving screenshot detection API. This API lets apps register callbacks on a per-activity basis. These callbacks are invoked, and the user is notified, when the user takes a screenshot while that activity is visible.

उपयोगकर्ता अनुभव

शेयरशीट में कस्टम कार्रवाइयां और बेहतर रैंकिंग

Android 14 में सिस्टम की शेयरशीट को अपडेट किया गया है, ताकि उपयोगकर्ताओं को कस्टम ऐप्लिकेशन ऐक्शन और ज़्यादा जानकारी देने वाली झलक के नतीजे दिखाए जा सकें.

कस्टम ऐक्शन जोड़ना

Android 14 में, आपका ऐप्लिकेशन सिस्टम शेयरशीट में कस्टम ऐक्शन जोड़ सकता है.

शेयरशीट पर कस्टम कार्रवाइयों का स्क्रीनशॉट.

डायरेक्ट शेयर टारगेट की रैंकिंग को बेहतर बनाना

Android 14, डायरेक्ट शेयर टारगेट की रैंकिंग तय करने के लिए, ऐप्लिकेशन से ज़्यादा सिग्नल का इस्तेमाल करता है. इससे उपयोगकर्ता को ज़्यादा मददगार नतीजे मिलते हैं. रैंकिंग के लिए सबसे काम का सिग्नल देने के लिए, डायरेक्ट शेयर टारगेट की रैंकिंग को बेहतर बनाने के लिए दिए गए दिशा-निर्देशों का पालन करें. कम्यूनिकेशन ऐप्लिकेशन, भेजे और पाए गए मैसेज के लिए, शॉर्टकट के इस्तेमाल की रिपोर्ट भी कर सकते हैं.

शेयरशीट में डायरेक्ट शेयर करने की लाइन, जैसा कि 1
से दिखाया गया है

प्रिडिक्टिव बैक के लिए, पहले से मौजूद और कस्टम ऐनिमेशन की सुविधा

Video: Predictive back animations

Android 13 introduced the predictive back-to-home animation behind a developer option. When used in a supported app with the developer option enabled, swiping back shows an animation indicating that the back gesture exits the app back to the home screen.

Android 14 includes multiple improvements and new guidance for Predictive Back:

With this Android 14 preview release, all features of Predictive Back remain behind a developer option. See the developer guide to migrate your app to predictive back, as well as the developer guide to creating custom in-app transitions.

बड़ी स्क्रीन वाले डिवाइस बनाने वाली कंपनी के हिसाब से, हर ऐप्लिकेशन के लिए सेटिंग में बदलाव करने की सुविधा

हर ऐप्लिकेशन के लिए बदलाव करने की सुविधा की मदद से, डिवाइस बनाने वाली कंपनियां बड़ी स्क्रीन वाले डिवाइसों पर ऐप्लिकेशन के काम करने के तरीके में बदलाव कर सकती हैं. उदाहरण के लिए, FORCE_RESIZE_APP ओवरराइड सिस्टम को डिसप्ले डाइमेंशन के हिसाब से ऐप्लिकेशन का साइज़ बदलने का निर्देश देता है, ताकि ऐप्लिकेशन के मेनिफ़ेस्ट में resizeableActivity="false" सेट हो. हालांकि, साइज़ के साथ काम करने वाले मोड का इस्तेमाल नहीं किया जाता.

ओवरराइड का मकसद, बड़ी स्क्रीन पर उपयोगकर्ता अनुभव को बेहतर बनाना है.

नई मेनिफ़ेस्ट प्रॉपर्टी की मदद से, डिवाइस बनाने वाली कुछ कंपनियों के बदलावों को अपने ऐप्लिकेशन के लिए बंद किया जा सकता है.

बड़ी स्क्रीन वाले डिवाइस पर, हर ऐप्लिकेशन के लिए उपयोगकर्ता की ओर से तय की गई सेटिंग

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.

ऐप्लिकेशन की स्क्रीन शेयर करने की सुविधा

App screen sharing enables users to share an app window instead of the entire device screen during screen content recording.

With app screen sharing, the status bar, navigation bar, notifications, and other system UI elements are excluded from the shared display. Only the content of the selected app is shared.

App screen sharing improves productivity and privacy by enabling users to run multiple apps but limit content sharing to a single app.

Pixel 8 Pro पर Gboard में एलएलएम की मदद से काम करने वाली स्मार्ट जवाब की सुविधा

Pixel 8 Pro डिवाइसों पर, दिसंबर में लॉन्च की गई सुविधाओं के साथ, डेवलपर Gboard में बेहतर क्वालिटी के स्मार्ट जवाबों को आज़मा सकते हैं. ये जवाब, Google Tensor पर चलने वाले डिवाइस पर मौजूद लार्ज लैंग्वेज मॉडल (एलएलएम) की मदद से जनरेट होते हैं.

यह सुविधा, WhatsApp, Line, और KakaoTalk में अमेरिकन इंग्लिश के लिए, सीमित तौर पर झलक के तौर पर उपलब्ध है. इसके लिए, Pixel 8 Pro डिवाइस का इस्तेमाल करना ज़रूरी है. साथ ही, Gboard को कीबोर्ड के तौर पर इस्तेमाल करना होगा.

इसे आज़माने के लिए, पहले सेटिंग > डेवलपर के लिए विकल्प > AICore की सेटिंग > 'AICore की सेटिंग हमेशा चालू रखें' को चालू करें.

इसके बाद, किसी ऐसे ऐप्लिकेशन में बातचीत खोलें जिसमें यह सुविधा काम करती है. इससे, आपको Gboard की सुझाव पट्टी में, आने वाले मैसेज के जवाब में एलएलएम की मदद से मिलने वाले स्मार्ट जवाब दिखेंगे.

Gboard, बेहतर क्वालिटी के स्मार्ट जवाब देने के लिए, डिवाइस पर मौजूद एलएलएम का इस्तेमाल करता है.

ग्राफ़िक्स

पाथ के बारे में क्वेरी की जा सकती है और उन्हें इंटरपोलेट किया जा सकता है

Android's Path API is a powerful and flexible mechanism for creating and rendering vector graphics, with the ability to stroke or fill a path, construct a path from line segments or quadratic or cubic curves, perform boolean operations to get even more complex shapes, or all of these simultaneously. One limitation is the ability to find out what is actually in a Path object; the internals of the object are opaque to callers after creation.

To create a Path, you call methods such as moveTo(), lineTo(), and cubicTo() to add path segments. But there has been no way to ask that path what the segments are, so you must retain that information at creation time.

Starting in Android 14, you can query paths to find out what's inside of them. First, you need to get a PathIterator object using the Path.getPathIterator API:

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();

Next, you can call PathIterator to iterate through the segments one by one, retrieving all of the necessary data for each segment. This example uses PathIterator.Segment objects, which packages up the data for you:

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 also has a non-allocating version of next() where you can pass in a buffer to hold the point data.

One of the important use cases of querying Path data is interpolation. For example, you might want to animate (or morph) between two different paths. To further simplify that use case, Android 14 also includes the interpolate() method on Path. Assuming the two paths have the same internal structure, the interpolate() method creates a new Path with that interpolated result. This example returns a path whose shape is halfway (a linear interpolation of .5) between path and otherPath:

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);
}

The Jetpack graphics-path library enables similar APIs for earlier versions of Android as well.

वर्टेक्स और फ़्रैगमेंट शेडर के साथ कस्टम मेश

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 के लिए हार्डवेयर बफ़र रेंडरर

To assist in using Android's Canvas API to draw with hardware acceleration into a HardwareBuffer, Android 14 introduces HardwareBufferRenderer. This API is particularly useful when your use case involves communication with the system compositor through SurfaceControl for low-latency drawing.