ऐप्लिकेशन के व्यवहार में बदलाव: सभी ऐप्लिकेशन

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

ऐप्लिकेशन के व्यवहार में हुए उन बदलावों की सूची भी ज़रूर देखें जिनसे सिर्फ़ ऐप्लिकेशन पर असर पड़ेगा टारगेट करने के लिए, Android 14.

मुख्य फ़ंक्शन

शेड्यूल किए गए सटीक समय वाले अलार्म को डिफ़ॉल्ट रूप से अस्वीकार किया जाता है

Exact alarms are meant for user-intentioned notifications, or for actions that need to happen at a precise time. Starting in Android 14, the SCHEDULE_EXACT_ALARM permission is no longer being pre-granted to most newly installed apps targeting Android 13 and higher—the permission is denied by default.

Learn more about the changes to the permission for scheduling exact alarms.

ऐप्लिकेशन के कैश मेमोरी में सेव होने के दौरान, कॉन्टेक्स्ट के हिसाब से रजिस्टर किए गए ब्रॉडकास्ट सूची में शामिल रहते हैं

On Android 14, the system can place context-registered broadcasts in a queue while the app is in the cached state. This is similar to the queuing behavior that Android 12 (API level 31) introduced for async binder transactions. Manifest-declared broadcasts aren't queued, and apps are removed from the cached state for broadcast delivery.

When the app leaves the cached state, such as returning to the foreground, the system delivers any queued broadcasts. Multiple instances of certain broadcasts might be merged into one broadcast. Depending on other factors, such as system health, apps might be removed from the cached state, and any previously queued broadcasts are delivered.

ऐप्लिकेशन सिर्फ़ अपनी बैकग्राउंड प्रोसेस को बंद कर सकते हैं

Starting in Android 14, when your app calls killBackgroundProcesses(), the API can kill only the background processes of your own app.

If you pass in the package name of another app, this method has no effect on that app's background processes, and the following message appears in Logcat:

Invalid packageName: com.example.anotherapp

Your app shouldn't use the killBackgroundProcesses() API or otherwise attempt to influence the process lifecycle of other apps, even on older OS versions. Android is designed to keep cached apps in the background and kill them automatically when the system needs memory. If your app kills other apps unnecessarily, it can reduce system performance and increase battery consumption by requiring full restarts of those apps later, which takes significantly more resources than resuming an existing cached app.

MTU का अनुरोध करने वाले पहले GATT क्लाइंट के लिए, MTU को 517 पर सेट किया गया है

Android 14 से, Android ब्लूटूथ स्टैक ब्लूटूथ कोर स्पेसिफ़िकेशन के वर्शन 5.2 का ज़्यादा सख्ती से पालन करता है. साथ ही, जब पहला GATT क्लाइंट BluetoothGatt#requestMtu(int) एपीआई का इस्तेमाल करके एमटीयू का अनुरोध करता है, तो BLE ATT एमटीयू को 517 बाइट तक का अनुरोध करता है. साथ ही, उस एसीएल कनेक्शन पर एमटीयू के सभी अनुरोधों को अनदेखा करता है.

इस बदलाव को ठीक करने और अपने ऐप्लिकेशन को ज़्यादा बेहतर बनाने के लिए, इन विकल्पों पर विचार करें:

  • आपका पेरिफ़रल डिवाइस, Android डिवाइस के एमटीयू अनुरोध का जवाब, ऐसी सही वैल्यू के साथ देना चाहिए जिसे पेरिफ़रल डिवाइस इस्तेमाल कर सके. बातचीत के बाद तय की गई आखिरी वैल्यू, Android के अनुरोध की गई वैल्यू और रिमोट की दी गई वैल्यू (उदाहरण के लिए, min(517, remoteMtu)) में से कम से कम वैल्यू होगी
    • इस समस्या को ठीक करने के लिए, सहायक डिवाइस के फ़र्मवेयर को अपडेट करना पड़ सकता है
  • इसके अलावा, अपने GATT विशेषता के डेटा को लिखने की सीमा तय करें. यह सीमा, आपके डिवाइस के लिए काम करने वाली वैल्यू और एमटीयू में हुए बदलाव के बीच की कम से कम वैल्यू के आधार पर तय की जा सकती है
    • आपको हेडर के लिए, इस्तेमाल किए जा सकने वाले साइज़ से 5 बाइट कम करने चाहिए
    • उदाहरण के लिए: arrayMaxLength = min(SUPPORTED_MTU, GATT_MAX_ATTR_LEN(517)) - 5

ऐप्लिकेशन को सीमित स्टैंडबाय बकेट में रखने की नई वजह

Android 14 में, प्रतिबंधित स्टैंडबाय बकेट में ऐप्लिकेशन को डालने की एक नई वजह जोड़ी गई है. ऐप्लिकेशन के जॉब, onStartJob, onStopJob या onBind तरीके के टाइम आउट की वजह से, कई बार ANR गड़बड़ियां ट्रिगर करते हैं. onStartJob और onStopJob में बदलावों के लिए, JobScheduler, कॉलबैक और नेटवर्क के व्यवहार को बेहतर बनाता है देखें.

यह ट्रैक करने के लिए कि ऐप्लिकेशन, पाबंदी वाली स्टैंडबाय बकेट में शामिल है या नहीं, हमारा सुझाव है कि आप जॉब के लागू होने पर UsageStatsManager.getAppStandbyBucket() या ऐप्लिकेशन के शुरू होने पर UsageStatsManager.queryEventsForSelf() एपीआई के साथ लॉग करें.

mlock 64 केबी तक सीमित है

In Android 14 (API level 34) and higher, the platform reduces the maximum memory that can be locked using mlock() to 64 KB per process. In previous versions, the limit was 64 MB per process. This restriction promotes better memory management across apps and the system. To provide more consistency across devices, Android 14 adds a new CTS test for the new mlock() limit on compatible devices.

सिस्टम, कैश मेमोरी में सेव किए गए ऐप्लिकेशन के संसाधनों के इस्तेमाल को लागू करता है

By design, an app's process is in a cached state when it's moved to the background and no other app process components are running. Such an app process is subject to being killed due to system memory pressure. Any work that Activity instances perform after the onStop() method has been called and returned, while in this state, is unreliable and strongly discouraged.

Android 14 introduces consistency and enforcement to this design. Shortly after an app process enters a cached state, background work is disallowed, until a process component re-enters an active state of the lifecycle.

Apps that use typical framework-supported lifecycle APIs – such as services, JobScheduler, and Jetpack WorkManager – shouldn't be impacted by these changes.

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

उपयोगकर्ताओं को, हटाई नहीं जा सकने वाली सूचनाओं के अनुभव में बदलाव

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

यह बदलाव उन ऐप्लिकेशन पर लागू होता है जो उपयोगकर्ताओं को फ़ोरग्राउंड खारिज करने से रोकते हैं Notification.FLAG_ONGOING_EVENT को इसके ज़रिए सेट करने पर मिलने वाली सूचनाएँ Notification.Builder#setOngoing(true) या NotificationCompat.Builder#setOngoing(true). इसका व्यवहार इस तरह की सूचनाओं को असल में दिखाने के लिए, FLAG_ONGOING_EVENT को बदल दिया गया है जिसे उपयोगकर्ता खारिज कर सकता है.

नीचे दी गई स्थितियों में, इस तरह की सूचनाएं अब भी खारिज नहीं की जा सकतीं शर्तें:

  • फ़ोन लॉक होने पर
  • अगर उपयोगकर्ता, सूचना से जुड़ी सभी हटाएं कार्रवाई चुनता है (इससे गलती से खारिज हो जाना)

साथ ही, यह नई कार्रवाई इस्तेमाल के ये उदाहरण:

  • CallStyle सूचनाएं
  • एंटरप्राइज़ के लिए डिवाइस नीति नियंत्रक (डीपीसी) और सहायक पैकेज
  • मीडिया से जुड़ी सूचनाएं
  • डिफ़ॉल्ट खोज सिलेक्टर पैकेज

डेटा की सुरक्षा से जुड़ी जानकारी ज़्यादा साफ़ तौर पर दिखती है

To enhance user privacy, Android 14 increases the number of places where the system shows the information you have declared in the Play Console form. Currently, users can view this information in the Data safety section on your app's listing in Google Play.

We encourage you to review your app's location data sharing policies and take a moment to make any applicable updates to your app's Google Play Data safety section.

Learn more in the guide about how data safety information is more visible on Android 14.

सुलभता

फ़ॉन्ट को 200% तक स्केल करने की सुविधा

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).

If you already use scaled pixels (sp) units to define text sizing, then this change probably won't have a high impact on your app. However, you should perform UI testing with the maximum font size enabled (200%) to ensure that your app can accommodate larger font sizes without impacting usability.

सुरक्षा

इंस्टॉल किया जा सकने वाला कम से कम टारगेट एपीआई लेवल

Android 14 और इसके बाद के वर्शन में, targetSdkVersion 23 से कम इंस्टॉल नहीं किया जा सकता. ऐप्लिकेशन को टारगेट एपीआई लेवल के इन कम से कम लेवल को पूरा करने के लिए ज़रूरी करना की शर्तों से, लोगों के लिए सुरक्षा और निजता को बेहतर बनाने में मदद मिलती है.

मैलवेयर, सुरक्षा और निजता को बायपास करने के लिए, अक्सर पुराने एपीआई लेवल को टारगेट करता है जो Android के नए वर्शन में उपलब्ध कराए गए हैं. उदाहरण के लिए, कुछ मैलवेयर ऐप्लिकेशनtargetSdkVersion रनटाइम अनुमति मॉडल को 2015 में Android 6.0 Marshmallow (एपीआई) ने लॉन्च किया था लेवल 23). Android 14 में किए गए इस बदलाव की वजह से, मैलवेयर से सुरक्षा को रोकना मुश्किल हो गया है और निजता में सुधार किए गए हैं. कम एपीआई लेवल को टारगेट करने वाले किसी ऐप्लिकेशन को इंस्टॉल करने की कोशिश करने पर, इंस्टॉल नहीं हो सका, और Logcat में यह मैसेज दिखता है:

INSTALL_FAILED_DEPRECATED_SDK_VERSION: App package must target at least SDK version 23, but found 7

Android 14 में अपग्रेड किए जा रहे डिवाइसों पर, targetSdkVersion से कम कीमत वाले ऐप्लिकेशन से 23 इंस्टॉल रहेंगे.

अगर आपको किसी पुराने एपीआई लेवल को टारगेट करने वाले ऐप्लिकेशन की जांच करनी है, तो ADB के इस कमांड का इस्तेमाल करें:

adb install --bypass-low-target-sdk-block FILENAME.apk

मीडिया के मालिक के पैकेज के नाम छिपाए जा सकते हैं

The media store supports queries for the OWNER_PACKAGE_NAME column, which indicates the app that stored a particular media file. Starting in Android 14, this value is redacted unless at least one of the following conditions is true:

  • The app that stored the media file has a package name that is always visible to other apps.
  • The app that queries the media store requests the QUERY_ALL_PACKAGES permission.

Learn more about how Android filters package visibility for privacy purposes.