हमारा सुझाव है कि 27 मार्च, 2025 से AOSP को बनाने और उसमें योगदान देने के लिए, aosp-main
के बजाय android-latest-release
का इस्तेमाल करें. ज़्यादा जानकारी के लिए, AOSP में हुए बदलाव लेख पढ़ें.
ऑपर्च्यूनिस्टिक लोकेशन की सुविधा पर पाबंदी लगाना
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
जब कोई ऐप्लिकेशन किसी डिवाइस की जगह की जानकारी का अनुरोध करता है, तो वह अनुरोध के जवाब का इंतज़ार कर सकता है या जगह की जानकारी सुनने वाले ऐप्लिकेशन का इस्तेमाल करके, जगह की जानकारी का अपडेट पा सकता है. यह सुविधा Android 9 और उससे पहले के वर्शन में उपलब्ध थी. साथ ही, यह तब दी जाती थी, जब कोई ऐप्लिकेशन सिर्फ़ जगह की जानकारी अपडेट करने की दर के बारे में बताता था और जगह की जानकारी पाने की दर के बारे में नहीं बताता था.
(जगह की जानकारी सुनने वाले ऐप्लिकेशन को, जगह की जानकारी के ऐसे अपडेट नहीं मिलते जो ज़रूरत पड़ने पर मिलते हैं. ऐसा इसलिए होता है, क्योंकि वे जगह की जानकारी अपडेट होने की दर तय नहीं करते.)
Android 10 और इसके बाद के वर्शन में, जगह की जानकारी के ऑपर्चुनिस्टिक अपडेट पाने के लिए, डेवलपर को यह बताना होगा कि उन्हें FusedLocationProviderClient
क्लास से जगह की जानकारी के पैसिव अपडेट चाहिए.
कई तरह से जांची गई सही जगह की जानकारी देने वाला एपीआई
ऐप्लिकेशन, FusedLocationProviderClient
क्लास से जगह की जानकारी के अपडेट मिलने की दर तय कर सकते हैं. इसके लिए, वे दो तरीकों का इस्तेमाल कर सकते हैं.
असर
अगर आपने setFastestInterval
के लिए कोई वैल्यू नहीं दी है, तो हो सकता है कि आपके ऐप्लिकेशन को जगह की जानकारी के अपडेट कम मिलें.
लागू करना
इस सुविधा को लागू करने के लिए, आपको FusedLocationProviderClient
क्लास setFastestInterval
तरीके के लिए सुझाई गई वैल्यू का इस्तेमाल करने के अलावा कुछ और करने की ज़रूरत नहीं है.
इस पेज पर मौजूद कॉन्टेंट और कोड सैंपल कॉन्टेंट के लाइसेंस में बताए गए लाइसेंस के हिसाब से हैं. Java और OpenJDK, Oracle और/या इससे जुड़ी हुई कंपनियों के ट्रेडमार्क या रजिस्टर किए हुए ट्रेडमार्क हैं.
आखिरी बार 2025-07-27 (UTC) को अपडेट किया गया.
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 2025-07-27 (UTC) को अपडेट किया गया."],[],[],null,["# Restrict opportunistic locations\n\nWhen an app requests a device's location, it can either wait for\nthe request response or, by using active location listeners, get an\nopportunistic location update. This was available (unrestricted) in\nAndroid 9 and lower, and was provided when an app specified only\nthe active location update rate, leaving the passive rate blank.\n(Passive location listeners don't receive opportunistic location\nupdates because they don't specify a location update rate.)\n\nStarting in Android 10, to get opportunistic\nlocation updates, developers must specify that they need passive location\nupdates from the **[FusedLocationProviderClient](https://developers.google.com/android/reference/com/google/android/gms/location\n/FusedLocationProviderClient)** class.\n\nFused location provider\n-----------------------\n\nApps can specify the rate at which they get opportunistic location updates from the [FusedLocationProviderClient](https://developers.google.com/android/reference/com/google/android/gms/location/FusedLocationProviderClient)\nclass in two ways.\n\n- Specify a value in the [setFastestInterval](https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest.html#setFastestInterval(long)) method that's lower than the value of the [setInterval](https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest.html#setInterval(long)) parameter. (Use a value of 0 ms or greater.)\n- Let the value be set automatically by leaving [setFastestInterval](https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest.html#setFastestInterval(long)) unspecified.\n\nImpact\n------\n\nIf you don't provide a value for [setFastestInterval](https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest.html#setFastestInterval(long)),\nyour app may experience a significant\nreduction in location updates delivered to it.\n\nImplementation\n--------------\n\nYou don't need to do anything to implement this feature other\nthan to use the suggested values for the [FusedLocationProviderClient](https://developers.google.com/android/reference/com/google/android/gms/location\n/FusedLocationProviderClient) class [setFastestInterval](https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest.html#setFastestInterval(long))\nmethod."]]