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 theLocaleConfigfile 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 theresfolders of your app modules and any library module dependencies to determine the locales to include in theLocaleConfigfile.Dynamic updates for an app's
localeConfig: Use thesetOverrideLocaleConfig()andgetOverrideLocaleConfig()methods inLocaleManagerto 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 billion people speak gendered languages: languages where grammatical categories—such as nouns, verbs, adjectives, and prepositions—inflect according to the gender of people and objects you talk to or about. Traditionally, many gendered languages use masculine grammatical gender as the default or generic gender.
Addressing users in the wrong grammatical gender, such as addressing women in masculine grammatical gender, can negatively impact their performance and attitude. In contrast, a UI with language that correctly reflects the user's grammatical gender can improve user engagement and provide a more personalized and natural-sounding user experience.
To help you build a user-centric UI for gendered languages, Android 14 introduces the Grammatical Inflection API, which lets you add support for grammatical gender without refactoring your app.
देश/इलाके के हिसाब से प्राथमिकताएं
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.
सुलभता
फ़ॉन्ट को 200% तक नॉन-लीनियर तरीके से बड़ा करना
Android 14 से, सिस्टम में फ़ॉन्ट को 200% तक बड़ा किया जा सकता है. इससे उपयोगकर्ताओं को सुलभता से जुड़ी अतिरिक्त सुविधाएं मिलती हैं.
स्क्रीन पर मौजूद बड़े टेक्स्ट एलिमेंट को बहुत ज़्यादा बड़ा होने से रोकने के लिए, सिस्टम नॉनलीनियर स्केलिंग कर्व का इस्तेमाल करता है. स्केलिंग की इस रणनीति का मतलब है कि बड़े टेक्स्ट को छोटे टेक्स्ट की तरह एक ही दर से स्केल नहीं किया जाता. नॉनलीनियर फ़ॉन्ट स्केलिंग की मदद से, अलग-अलग साइज़ के एलिमेंट के बीच आनुपातिक क्रम को बनाए रखने में मदद मिलती है. साथ ही, इससे ज़्यादा डिग्री पर लीनियर टेक्स्ट स्केलिंग से जुड़े जोखिम को कम किया जा सकता है. जैसे, टेक्स्ट का कट जाना या बहुत बड़े डिसप्ले साइज़ की वजह से टेक्स्ट को पढ़ने में मुश्किल होना.
नॉनलीनियर फ़ॉन्ट स्केलिंग की सुविधा के साथ अपने ऐप्लिकेशन की जांच करना
अगर आपने टेक्स्ट के साइज़ को तय करने के लिए, पहले से ही स्केल्ड पिक्सल (sp) यूनिट का इस्तेमाल किया है, तो ये अतिरिक्त विकल्प और स्केलिंग से जुड़े सुधार, आपके ऐप्लिकेशन के टेक्स्ट पर अपने-आप लागू हो जाते हैं. हालांकि, आपको अब भी यूज़र इंटरफ़ेस (यूआई) की टेस्टिंग करनी चाहिए. इसके लिए, फ़ॉन्ट के सबसे बड़े साइज़ (200%) को चालू करें. इससे यह पक्का किया जा सकेगा कि आपका ऐप्लिकेशन, फ़ॉन्ट के साइज़ को सही तरीके से लागू करता है और इस्तेमाल में आसानी पर असर डाले बिना, बड़े फ़ॉन्ट साइज़ को अडजस्ट कर सकता है.
फ़ॉन्ट का साइज़ 200% पर सेट करने के लिए, यह तरीका अपनाएं:
- सेटिंग ऐप्लिकेशन खोलें और सुलभता > डिसप्ले साइज़ और टेक्स्ट पर जाएं.
- फ़ॉन्ट का साइज़ विकल्प के लिए, प्लस (+) आइकॉन पर तब तक टैप करें, जब तक फ़ॉन्ट के सबसे बड़े साइज़ की सेटिंग चालू न हो जाए. इस सेक्शन के साथ दी गई इमेज में यह दिखाया गया है.
टेक्स्ट के साइज़ के लिए, स्केल किए गए पिक्सल (एसपी) यूनिट का इस्तेमाल करना
हमेशा टेक्स्ट के साइज़ को एसपी यूनिट में तय करें. जब आपका ऐप्लिकेशन sp यूनिट का इस्तेमाल करता है, तो Android, उपयोगकर्ता की पसंद के टेक्स्ट साइज़ को लागू कर सकता है और उसे सही तरीके से स्केल कर सकता है.
पैडिंग के लिए एसपी यूनिट का इस्तेमाल न करें या व्यू की ऊंचाई तय करते समय, पैडिंग को शामिल न करें: नॉनलीनियर फ़ॉन्ट स्केलिंग के साथ, एसपी डाइमेंशन आनुपातिक नहीं हो सकते. इसलिए, 4sp + 20sp, 24sp के बराबर नहीं हो सकता.
स्केल्ड पिक्सल (sp) यूनिट को बदलना
sp यूनिट को पिक्सल में बदलने के लिए, TypedValue.applyDimension() का इस्तेमाल करें. साथ ही, पिक्सल को sp में बदलने के लिए, TypedValue.deriveDimension() का इस्तेमाल करें. इन तरीकों से, सही नॉनलीनियर स्केलिंग कर्व अपने-आप लागू हो जाता है.
Configuration.fontScale या
DisplayMetrics.scaledDensity का इस्तेमाल करके, इक्वेशन को हार्डकोड करने से बचें. फ़ॉन्ट का साइज़ बढ़ाने की सुविधा नॉनलीनियर होती है. इसलिए, scaledDensity फ़ील्ड अब सटीक नहीं है. fontScale फ़ील्ड का इस्तेमाल सिर्फ़ जानकारी देने के मकसद से किया जाना चाहिए. ऐसा इसलिए, क्योंकि अब फ़ॉन्ट को किसी एक स्केलर वैल्यू के हिसाब से नहीं बढ़ाया जाता.
लाइनहाइट के लिए sp यूनिट का इस्तेमाल करना
हमेशा android:lineHeight को dp के बजाय sp यूनिट का इस्तेमाल करके तय करें, ताकि लाइन की ऊंचाई आपके टेक्स्ट के साथ स्केल हो सके. इसके अलावा, अगर आपका टेक्स्ट sp में है, लेकिन आपका lineHeight dp या px में है, तो यह स्केल नहीं होता और छोटा दिखता है.
TextView, lineHeight को अपने-आप ठीक कर देता है, ताकि आपके तय किए गए अनुपात बने रहें. हालांकि, ऐसा सिर्फ़ तब होता है, जब textSize और lineHeight दोनों को sp यूनिट में तय किया गया हो.
कैमरा और मीडिया
इमेज के लिए अल्ट्रा एचडीआर
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:
- Dynamic still capture processing latency estimation provides much more
accurate still capture latency estimates based on the current scene and
environment conditions. Call
CameraExtensionSession.getRealtimeStillCaptureLatency()to get aStillCaptureLatencyobject that has two latency estimation methods. ThegetCaptureLatency()method returns the estimated latency betweenonCaptureStartedandonCaptureProcessStarted(), and thegetProcessingLatency()method returns the estimated latency betweenonCaptureProcessStarted()and the final processed frame being available. - Support for capture progress callbacks so that apps can display the current
progress of long-running, still-capture processing operations. You can check
if this feature is available with
CameraExtensionCharacteristics.isCaptureProcessProgressAvailable, and if it is, you implement theonCaptureProcessProgressed()callback, which has the progress (from 0 to 100) passed in as a parameter. Extension specific metadata, such as
CaptureRequest.EXTENSION_STRENGTHfor dialing in the amount of an extension effect, such as the amount of background blur withEXTENSION_BOKEH.Postview Feature for Still Capture in camera extensions, which provides a less-processed image more quickly than the final image. If an extension has increased processing latency, a postview image could be provided as a placeholder to improve UX and switched out later for the final image. You can check if this feature is available with
CameraExtensionCharacteristics.isPostviewAvailable. Then you can pass anOutputConfigurationtoExtensionSessionConfiguration.setPostviewOutputConfiguration.Support for
SurfaceViewallowing for a more optimized and power-efficient preview render path.Support for tap to focus and zoom during extension usage.
इन-सेंसर ज़ूम
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 支持无损音频格式,可通过 USB 有线耳机提供发烧友级体验。您可以查询 USB 设备的首选混音器属性,注册监听器以监听首选混音器属性的更改,以及使用 AudioMixerAttributes 类配置混音器属性。此类表示音频混音器的格式,例如声道掩码、采样率和行为。该类允许直接发送音频,而无需混音、调节音量或处理效果。
डेवलपर की प्रॉडक्टिविटी और टूल
Credential Manager
Android 14 将 Credential Manager 添加为平台 API,并通过使用 Google Play 服务的 Jetpack 库,向后额外支持 Android 4.4(API 级别 19)设备。Credential Manager 旨在通过 API 使用用户配置的凭据提供程序检索和存储凭据,让用户更轻松地登录。Credential Manager 在单个 API 中支持多种登录方法,包括用户名和密码、通行密钥和联合登录解决方案(如“使用 Google 账号登录”)。
通行密钥具有许多优势。例如,通行密钥是基于业界标准构建的,可在各种不同的操作系统和浏览器生态系统中使用,并且可用于网站和应用。
如需了解详情,请参阅 Credential Manager 和通行密钥文档以及介绍 Credential Manager 和通行密钥的博文。
Health Connect
Health Connect 是用户健康与健身数据的设备端仓库。借助该功能,用户可以在一个位置控制要与这些应用共享哪些数据,并在自己喜爱的应用之间共享数据。
在搭载 Android 14 之前的 Android 版本的设备上,Health Connect 可作为应用从 Google Play 商店下载。从 Android 14 开始,Health Connect 将成为 Android 平台的一部分,并通过 Google Play 系统更新接收更新,而无需单独下载。这样一来,Health Connect 就可以频繁更新,您的应用可以依赖于搭载 Android 14 或更高版本的设备上提供的 Health Connect。用户可以通过设备的“设置”访问 Health Connect,隐私控制功能集成到系统设置中。
Health Connect 在 Android 14 中包含多项新功能,例如锻炼路线,可让用户分享可在地图上直观呈现的锻炼路线。路线定义为在一定时间范围内保存的位置列表,您的应用可以将路线插入锻炼时段,将它们关联起来。为确保用户能够完全控制此类敏感数据,用户必须允许与其他应用共享单个路线。
如需了解详情,请参阅 Health Connect 文档以及有关 Android Health 中的新功能的博文。
OpenJDK 17 के अपडेट
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.baseclasses 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
instanceofwithout 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.
ऐप्लिकेशन स्टोर के लिए सुधार
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 updates the system sharesheet to support custom app actions and more informative preview results for users.
Add custom actions
With Android 14, your app can add custom actions to the system sharesheet it invokes.
Improve ranking of Direct Share targets
Android 14 uses more signals from apps to determine the ranking of the direct share targets to provide more helpful results for the user. To provide the most useful signal for ranking, follow the guidance for improving rankings of your Direct Share targets. Communication apps can also report shortcut usage for outgoing and incoming messages.
पीछे जाने पर झलक दिखाने की सुविधा के लिए, पहले से मौजूद और कस्टम ऐनिमेशन की सुविधा
Android 13 在开发者选项背后引入了预测性“返回主屏幕”动画。在已启用开发者选项的受支持应用中使用时,滑回手势会显示动画,表明返回手势会使应用退回到主屏幕。
Android 14 包含针对“预测性返回”的多项改进和新指南:
- 您可设置
android:enableOnBackInvokedCallback=true,以便为每个 activity 选择启用预测性返回系统动画,而不是为整个应用选择启用。 - 我们添加了新的系统动画,以配合 Android 13 中的“返回主屏幕”动画。新的系统动画是跨 activity 和跨任务的,您可在迁移到预测性返回后自动获得该动画。
- 我们为底部动作条、侧边动作条和搜索添加了新的 Material 组件动画。
- 我们制作了有关如何创建自定义应用内动画和转换的设计指南。
- 我们添加了许多新 API 来支持自定义的应用内转换动画:
在此 Android 14 预览版中,所有预测性返回功能都是位于开发者选项背后。请参阅与将您的应用迁移到预测性返回有关的开发者指南,以及与创建自定义应用内转换有关的开发者指南。
बड़ी स्क्रीन वाले डिवाइस बनाने वाली कंपनी के हिसाब से, हर ऐप्लिकेशन के लिए सेटिंग में बदलाव करने की सुविधा
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.
बड़ी स्क्रीन वाले डिवाइस पर, हर ऐप्लिकेशन के लिए सेटिंग में बदलाव करने की सुविधा
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.
ऐप्लिकेशन की स्क्रीन शेयर करने की सुविधा
ऐप्लिकेशन की स्क्रीन शेयर करने की सुविधा की मदद से, उपयोगकर्ता स्क्रीन कॉन्टेंट रिकॉर्ड करते समय, डिवाइस की पूरी स्क्रीन के बजाय, ऐप्लिकेशन की विंडो शेयर कर सकते हैं.
ऐप्लिकेशन की स्क्रीन शेयर करने की सुविधा का इस्तेमाल करने पर, स्टेटस बार, नेविगेशन बार, सूचनाएं, और सिस्टम के अन्य यूज़र इंटरफ़ेस (यूआई) एलिमेंट शेयर किए गए डिसप्ले में शामिल नहीं होते. सिर्फ़ चुने गए ऐप्लिकेशन का कॉन्टेंट शेयर किया जाता है.
ऐप्लिकेशन की स्क्रीन शेयर करने की सुविधा से, उपयोगकर्ताओं की प्रोडक्टिविटी और निजता बेहतर होती है. इसकी मदद से, वे एक से ज़्यादा ऐप्लिकेशन चला सकते हैं. हालांकि, कॉन्टेंट शेयर करने की सुविधा सिर्फ़ एक ऐप्लिकेशन के लिए उपलब्ध होती है.
Pixel 8 Pro पर Gboard में एलएलएम की मदद से काम करने वाली स्मार्ट जवाब की सुविधा
Pixel 8 Pro डिवाइसों पर, दिसंबर में लॉन्च की गई सुविधाओं के साथ, डेवलपर Gboard में बेहतर क्वालिटी के स्मार्ट जवाबों को आज़मा सकते हैं. ये जवाब, Google Tensor पर चलने वाले डिवाइस पर मौजूद लार्ज लैंग्वेज मॉडल (एलएलएम) की मदद से जनरेट होते हैं.
यह सुविधा, WhatsApp, Line, और KakaoTalk में अमेरिकन इंग्लिश के लिए, सीमित तौर पर झलक के तौर पर उपलब्ध है. इसके लिए, Pixel 8 Pro डिवाइस का इस्तेमाल करना ज़रूरी है. साथ ही, Gboard को कीबोर्ड के तौर पर इस्तेमाल करना होगा.
इसे आज़माने के लिए, पहले सेटिंग > डेवलपर के लिए विकल्प > AICore की सेटिंग > 'AICore की सेटिंग हमेशा चालू रखें' को चालू करें.
इसके बाद, किसी ऐसे ऐप्लिकेशन में बातचीत खोलें जिसमें यह सुविधा काम करती है. इससे, आपको Gboard की सुझाव पट्टी में, आने वाले मैसेज के जवाब में एलएलएम की मदद से मिलने वाले स्मार्ट जवाब दिखेंगे.
ग्राफ़िक
पाथ के बारे में क्वेरी की जा सकती है और उन्हें इंटरपोलेट किया जा सकता है
Android का Path एपीआई, वेक्टर ग्राफ़िक बनाने और रेंडर करने का एक बेहतरीन और सुविधाजनक तरीका है. इसमें पाथ को स्ट्रोक करने या भरने, लाइन सेगमेंट या क्वाड्रेटिक या क्यूबिक कर्व से पाथ बनाने, ज़्यादा जटिल आकार या इन सभी को एक साथ पाने के लिए बूलियन ऑपरेशन करने की सुविधा है. एक सीमा यह पता लगाने की क्षमता है कि असल में पाथ ऑब्जेक्ट में क्या है; बनाने के बाद ऑब्जेक्ट के अंदरूनी हिस्से, कॉलर को नहीं दिखते.
Path बनाने के लिए, पाथ सेगमेंट जोड़ने के लिए, moveTo(), lineTo(), और cubicTo() जैसे तरीकों को कॉल किया जाता है. हालांकि, उस पाथ से यह पूछने का कोई तरीका नहीं है कि सेगमेंट क्या हैं. इसलिए, आपको उस जानकारी को बनाने के समय सेव रखना होगा.
Android 14 में पाथ में क्या मौजूद है, यह जानने के लिए पाथ में क्वेरी की जा सकती है.
सबसे पहले, आपको Path.getPathIterator एपीआई का इस्तेमाल करके, PathIterator ऑब्जेक्ट हासिल करना होगा:
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();
इसके बाद, PathIterator को कॉल करके, हर सेगमेंट के लिए ज़रूरी डेटा को एक-एक करके पाया जा सकता है. इस उदाहरण में, PathIterator.Segment ऑब्जेक्ट का इस्तेमाल किया गया है, जो आपके लिए डेटा को पैकेज करता है:
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 में next() का ऐसा वर्शन भी होता है जिसमें पॉइंट डेटा को सेव करने के लिए बफ़र को पास किया जा सकता है.
Path डेटा के बारे में क्वेरी करने के इस्तेमाल के उदाहरणों में से एक है इंटरपोलेशन. उदाहरण के लिए, हो सकता है कि आप दो अलग-अलग पाथ के बीच ऐनिमेट (या मॉर्फ़) करना चाहें. इस्तेमाल के इस उदाहरण को और आसान बनाने के लिए, Android 14 में Path पर interpolate() तरीका भी शामिल किया गया है. यह मानते हुए कि दोनों पाथ का इंटरनल स्ट्रक्चर एक जैसा है, interpolate() वाला तरीका इंटरपोलेट किए गए नतीजे के साथ एक नया Path बनाता है. इस उदाहरण में, path और otherPath के बीच आधा (.5 का लीनियर इंटरपोलेशन) आकार वाला पाथ दिखता है:
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 लाइब्रेरी Android के पुराने वर्शन के लिए भी मिलते-जुलते एपीआई चालू करती है.
वर्टेक्स और फ़्रैगमेंट शेडर के साथ कस्टम मेश
Android में, कस्टम शेडिंग के साथ ट्राएंगल मेश बनाने की सुविधा लंबे समय से उपलब्ध है. हालांकि, इनपुट मेश फ़ॉर्मैट में पहले से तय किए गए कुछ एट्रिब्यूट कॉम्बिनेशन ही इस्तेमाल किए जा सकते हैं. Android 14 में कस्टम मेश के लिए सहायता जोड़ी गई है. इन्हें त्रिकोण या त्रिकोण के स्ट्रिप के तौर पर परिभाषित किया जा सकता है. साथ ही, इन्हें इंडेक्स भी किया जा सकता है. इन मेश को कस्टम एट्रिब्यूट, वर्टिक्स स्ट्राइड, वैरिएंट, और वर्टिक्स और फ़्रैगमेंट शेडर के साथ AGSL में लिखकर तय किया जाता है.
वर्टिक्स शेडर, पोज़िशन और रंग जैसे वैरिएशन तय करता है. वहीं, फ़्रेगमेंट शेडर, वैकल्पिक तौर पर पिक्सल के लिए रंग तय कर सकता है. आम तौर पर, ऐसा वर्टिक्स शेडर से बनाए गए वैरिएशन का इस्तेमाल करके किया जाता है. अगर कलर, फ़्रेगमेंट शेडर से दिया जाता है, तो इसे मेश बनाते समय चुने गए ब्लेंड मोड का इस्तेमाल करके, मौजूदा Paint रंग के साथ ब्लेंड किया जाता है. ज़्यादा सुविधाओं के लिए, यूनिफ़ॉर्म को फ़्रैगमेंट और वर्टिक्स शेडर में पास किया जा सकता है.
Canvas के लिए हार्डवेयर बफ़र रेंडरर
Android 14 में HardwareBufferRenderer को शामिल किया गया है. इससे, HardwareBuffer में हार्डवेयर ऐक्सेलरेशन की मदद से ड्रॉ करने के लिए, Android के Canvas एपीआई का इस्तेमाल करने में मदद मिलती है. यह एपीआई, कम इंतज़ार के साथ ड्रॉइंग के लिए, SurfaceControl के ज़रिए सिस्टम कंपोजिटर के साथ कम्यूनिकेशन करने के लिए, खास तौर पर तब फ़ायदेमंद होता है, जब आपके इस्तेमाल के उदाहरण में यह शामिल हो.