Android 14 में डेवलपर के लिए कई बेहतरीन सुविधाएं और एपीआई उपलब्ध हैं. यहां दी गई मदद से, आपको अपने ऐप्लिकेशन के लिए उपलब्ध सुविधाओं के बारे में जानने और उनसे जुड़े एपीआई का इस्तेमाल शुरू करने में मदद मिलेगी.
जोड़े गए, बदले गए, और हटाए गए एपीआई की पूरी सूची देखने के लिए, एपीआई में हुए बदलाव की रिपोर्ट पढ़ें. जोड़े गए एपीआई के बारे में ज़्यादा जानने के लिए, Android API के बारे में जानकारी पर जाएं. Android 14 के लिए, एपीआई लेवल 34 में जोड़े गए एपीआई देखें. जिन प्लैटफ़ॉर्म में हुए बदलावों से आपके ऐप्लिकेशन पर असर पड़ सकता है उनके बारे में जानने के लिए, Android 14 में हुए बदलावों के बारे में जानकारी देने वाले पेज ज़रूर देखें. ये पेज, Android 14 को टारगेट करने वाले ऐप्लिकेशन और सभी ऐप्लिकेशन के लिए उपलब्ध हैं.
इंटरनैशनलाइजेशन
हर ऐप्लिकेशन के हिसाब से पसंद की भाषा
Android 14 में, हर ऐप्लिकेशन के लिए भाषा से जुड़ी उन सुविधाओं को बेहतर बनाया गया है जिन्हें Android 13 (एपीआई लेवल 33) में लॉन्च किया गया था. साथ ही, इसमें ये नई सुविधाएं भी जोड़ी गई हैं:
ऐप्लिकेशन का
localeConfigअपने-आप जनरेट होना: Android Studio Giraffe Canary 7 और AGP 8.1.0-alpha07 से, अपने ऐप्लिकेशन को हर ऐप्लिकेशन के लिए भाषा की सेटिंग के साथ काम करने के लिए कॉन्फ़िगर किया जा सकता है. आपके प्रोजेक्ट के संसाधनों के आधार पर, Android Gradle प्लग इनLocaleConfigफ़ाइल जनरेट करता है और फ़ाइनल मेनिफ़ेस्ट फ़ाइल में इसका रेफ़रंस जोड़ता है. इससे, आपको फ़ाइल को मैन्युअल तरीके से बनाने या अपडेट करने की ज़रूरत नहीं पड़ती. AGP, आपके ऐप्लिकेशन मॉड्यूल केresफ़ोल्डर और लाइब्रेरी मॉड्यूल की डिपेंडेंसी में मौजूद संसाधनों का इस्तेमाल करता है. इससे,LocaleConfigफ़ाइल में शामिल करने के लिए स्थानीय भाषाओं का पता चलता है.ऐप्लिकेशन के
localeConfigके लिए डाइनैमिक अपडेट:LocaleManagerमें दिए गएsetOverrideLocaleConfig()औरgetOverrideLocaleConfig()तरीकों का इस्तेमाल करके, डिवाइस की सिस्टम सेटिंग में, ऐप्लिकेशन पर इस्तेमाल की जा सकने वाली भाषाओं की सूची को डाइनैमिक तौर पर अपडेट करें. इस सुविधा का इस्तेमाल करके, हर इलाके के हिसाब से इस्तेमाल की जा सकने वाली भाषाओं की सूची को पसंद के मुताबिक बनाएं, A/B प्रयोग चलाएं या स्थानीय भाषाओं की अपडेट की गई सूची दें. ऐसा तब करें, जब आपका ऐप्लिकेशन स्थानीय भाषा के लिए सर्वर-साइड पुश का इस्तेमाल करता हो.इनपुट के तरीके के संपादकों (आईएमई) के लिए ऐप्लिकेशन की भाषा दिखना: आईएमई,
getApplicationLocales()के तरीके का इस्तेमाल करके, मौजूदा ऐप्लिकेशन की भाषा की जांच कर सकते हैं और आईएमई की भाषा को उस भाषा से मैच कर सकते हैं.
Grammatical Inflection API
दुनिया भर में 3 अरब लोग लिंग के हिसाब से अलग-अलग तरह से इस्तेमाल होने वाली भाषाएं बोलते हैं. इन भाषाओं में, व्याकरण की कैटगरी, जैसे कि संज्ञा, क्रिया, विशेषण, और प्रीपोज़िशन, उन लोगों और ऑब्जेक्ट के लिंग के हिसाब से बदलते हैं जिनके बारे में बात की जा रही है. आम तौर पर, लैंगिक भेद वाली कई भाषाओं में, मर्दों के लिए इस्तेमाल होने वाले व्याकरण के लिंग को डिफ़ॉल्ट या सामान्य लिंग के तौर पर इस्तेमाल किया जाता है.
उपयोगकर्ताओं को गलत व्याकरण के हिसाब से संबोधित करने से, उनकी परफ़ॉर्मेंस और व्यवहार पर बुरा असर पड़ सकता है. जैसे, महिलाओं को पुल्लिग व्याकरण के हिसाब से संबोधित करना. इसके उलट, यूज़र इंटरफ़ेस (यूआई) में ऐसी भाषा का इस्तेमाल करने से, उपयोगकर्ता के व्याकरण के हिसाब से लिंग की जानकारी सही तरीके से दिखती है. इससे उपयोगकर्ता जुड़ाव बढ़ता है और उपयोगकर्ता को ज़्यादा पसंद के मुताबिक और स्वाभाविक अनुभव मिलता है.
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 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 में, Credential Manager को प्लैटफ़ॉर्म एपीआई के तौर पर जोड़ा गया है. साथ ही, Google Play services का इस्तेमाल करके Jetpack लाइब्रेरी के ज़रिए, Android 4.4 (एपीआई लेवल 19) डिवाइसों के लिए अतिरिक्त सहायता भी जोड़ी गई है. Credential Manager का मकसद, उपयोगकर्ताओं के लिए साइन इन करने की प्रोसेस को आसान बनाना है. इसके लिए, यह एपीआई का इस्तेमाल करता है. ये एपीआई, उपयोगकर्ता के कॉन्फ़िगर किए गए क्रेडेंशियल प्रोवाइडर की मदद से क्रेडेंशियल हासिल और सेव करते हैं. Credential Manager, एक ही एपीआई में साइन इन करने के कई तरीकों के साथ काम करता है. जैसे, उपयोगकर्ता नाम और पासवर्ड, पासकी, और फ़ेडरेटेड साइन-इन के समाधान (जैसे, 'Google से साइन इन करें').
पासकी के कई फ़ायदे हैं. उदाहरण के लिए, पासकी इंडस्ट्री स्टैंडर्ड के हिसाब से बनाई गई हैं. ये अलग-अलग ऑपरेटिंग सिस्टम और ब्राउज़र ईकोसिस्टम पर काम करती हैं. साथ ही, वेबसाइटों और ऐप्लिकेशन, दोनों के लिए इस्तेमाल की जा सकती हैं.
ज़्यादा जानकारी के लिए, क्रेडेंशियल मैनेजर और पासकी के दस्तावेज़ और क्रेडेंशियल मैनेजर और पासकी के बारे में ब्लॉग पोस्ट देखें.
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.
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 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 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:
- You can set
android:enableOnBackInvokedCallback=trueto opt in to predictive back system animations per-Activity instead of for the entire app. - We've added new system animations to accompany the back-to-home animation from Android 13. The new system animations are cross-activity and cross-task, which you get automatically after migrating to Predictive Back.
- We've added new Material Component animations for Bottom sheets, Side sheets, and Search.
- We've created design guidance for creating custom in-app animations and transitions.
- We've added new APIs to support custom in-app transition animations:
handleOnBackStarted,handleOnBackProgressed,handleOnBackCancelledinOnBackPressedCallbackonBackStarted,onBackProgressed,onBackCancelledinOnBackAnimationCallback- Use
overrideActivityTransitioninstead ofoverridePendingTransitionfor transitions that respond as the user swipes 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.
बड़ी स्क्रीन वाले डिवाइस बनाने वाली कंपनी के हिसाब से, हर ऐप्लिकेशन के लिए सेटिंग में बदलाव करने की सुविधा
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 में एलएलएम की मदद से काम करने वाली स्मार्ट जवाब की सुविधा
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.
ग्राफ़िक
पाथ के बारे में क्वेरी की जा सकती है और उन्हें इंटरपोलेट किया जा सकता है
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 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.