बैकग्राउंड में जगह की जानकारी ऐक्सेस करना
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
जगह की जानकारी ऐक्सेस करने की अनुमतियां मांगना और निजता से जुड़े सबसे सही तरीके पेजों पर बताया गया है कि ऐप्लिकेशन को सिर्फ़ उस तरह की जगह की जानकारी ऐक्सेस करने की अनुमति मांगनी चाहिए जो लोगों को उपलब्ध कराई जाने वाली सुविधा के लिए ज़रूरी है. साथ ही, उन्हें इसके बारे में साफ़ तौर पर बताना चाहिए. ज़्यादातर मामलों में, ऐप्लिकेशन का इस्तेमाल करते समय ही जगह की जानकारी की ज़रूरत होती है. अगर आपके ऐप्लिकेशन को बैकग्राउंड में जगह की जानकारी की ज़रूरत होती है, जैसे कि जियोफ़ेंसिंग लागू करते समय, तो पक्का करें कि यह ऐप्लिकेशन के मुख्य फ़ंक्शन के लिए ज़रूरी हो. साथ ही, इससे लोगों को साफ़ तौर पर फ़ायदे मिलते हों और यह इस तरह से किया गया हो कि लोगों को इसके बारे में पता हो.
ध्यान दें: Google Play Store ने डिवाइस की जगह की जानकारी से जुड़ी अपनी नीति को अपडेट किया है. इसके तहत, बैकग्राउंड में जगह की जानकारी ऐक्सेस करने की सुविधा सिर्फ़ उन ऐप्लिकेशन को मिलेगी जो इस सुविधा का इस्तेमाल अपनी मुख्य सुविधाओं के लिए करते हैं. साथ ही, वे इस सुविधा से जुड़ी नीति की ज़रूरी शर्तों को पूरा करते हैं. इन सबसे सही तरीकों को अपनाने से, इस बात की गारंटी नहीं मिलती कि Google Play, बैकग्राउंड में जगह की जानकारी का इस्तेमाल करने के लिए आपके ऐप्लिकेशन को मंज़ूरी देगा.
डिवाइस की जगह की जानकारी से जुड़ी नीति में हुए बदलावों के बारे में ज़्यादा जानें.
बैकग्राउंड में जगह की जानकारी ऐक्सेस करने से जुड़ी चेकलिस्ट
बैकग्राउंड में जगह की जानकारी ऐक्सेस करने के लॉजिक की पहचान करने के लिए, इस चेकलिस्ट का इस्तेमाल करें:
अपने ऐप्लिकेशन के मेनिफ़ेस्ट में, ACCESS_COARSE_LOCATION
अनुमति और ACCESS_FINE_LOCATION
अनुमति की जांच करें.
पुष्टि करें कि आपके ऐप्लिकेशन को जगह की जानकारी की इन अनुमतियों की ज़रूरत है.
- अगर आपका ऐप्लिकेशन, Android 10 (एपीआई लेवल 29) या उसके बाद के वर्शन को टारगेट करता है, तो
ACCESS_BACKGROUND_LOCATION
अनुमति भी देखें.
पुष्टि करें कि आपके ऐप्लिकेशन में ऐसी सुविधा मौजूद है जिसके लिए इसकी ज़रूरत है.
अपने कोड में, जगह की जानकारी ऐक्सेस करने वाले एपीआई का इस्तेमाल देखें. जैसे, कई तरह से जांची गई सही जगह की जानकारी देने वाला एपीआई, जियोफ़ेंसिंग एपीआई या LocationManager API. जैसे, यहां दिए गए कंस्ट्रक्ट में:
अगर आपका ऐप्लिकेशन, जगह की जानकारी ऐक्सेस करने वाले किसी एसडीके या लाइब्रेरी का इस्तेमाल करता है, तो इस ऐक्सेस का श्रेय आपके ऐप्लिकेशन को दिया जाता है. यह पता लगाने के लिए कि किसी एसडीके या लाइब्रेरी को जगह की जानकारी ऐक्सेस करने की ज़रूरत है या नहीं, लाइब्रेरी के दस्तावेज़ देखें.
बैकग्राउंड में जगह की जानकारी ऐक्सेस करने की सुविधा का आकलन करना
अगर आपको पता चलता है कि आपका ऐप्लिकेशन, बैकग्राउंड में जगह की जानकारी ऐक्सेस करता है, तो ये कार्रवाइयां करें:
- यह आकलन करें कि क्या बैकग्राउंड में जगह की जानकारी ऐक्सेस करना, ऐप्लिकेशन के मुख्य फ़ंक्शन के लिए ज़रूरी है.
अगर आपको बैकग्राउंड में जगह की जानकारी ऐक्सेस करने की ज़रूरत नहीं है, तो इसे हटा दें.
अगर आपका ऐप्लिकेशन, Android 10 (एपीआई लेवल 29) या उसके बाद के वर्शन को टारगेट करता है, तो अपने ऐप्लिकेशन के मेनिफ़ेस्ट से ACCESS_BACKGROUND_LOCATION
permission
को हटा दें. इस अनुमति को हटाने पर, Android 10 पर चलने वाले डिवाइसों पर, ऐप्लिकेशन के लिए हर समय जगह की जानकारी ऐक्सेस करने का विकल्प उपलब्ध नहीं होता.
पक्का करें कि उपयोगकर्ता को पता हो कि आपका ऐप्लिकेशन, बैकग्राउंड में उसकी जगह की जानकारी ऐक्सेस कर रहा है. यह उन मामलों में खास तौर पर ज़रूरी है जिनके बारे में लोगों को साफ़ तौर पर पता नहीं होता.
अगर हो सके, तो जगह की जानकारी ऐक्सेस करने के लॉजिक को फिर से व्यवस्थित करें, ताकि आप जगह की जानकारी का अनुरोध सिर्फ़ तब करें, जब आपके ऐप्लिकेशन की गतिविधि लोगों को दिख रही हो.
बैकग्राउंड में जगह की जानकारी ऐक्सेस करने के अनुरोध से जुड़े अपडेट सीमित तौर पर भेजे जाते हैं
अगर आपके ऐप्लिकेशन के लिए बैकग्राउंड में जगह की जानकारी का ऐक्सेस ज़रूरी है, तो ध्यान रखें कि Android 8.0 (एपीआई लेवल 26) और उसके बाद के वर्शन पर काम करने वाले डिवाइसों पर, Android, बैकग्राउंड में जगह की जानकारी के ऐक्सेस की सीमाएं सेट करके, डिवाइस की बैटरी लाइफ़ को बनाए रखता है. Android के इन वर्शन पर, अगर आपका ऐप्लिकेशन बैकग्राउंड में चल रहा है, तो उसे हर घंटे में सिर्फ़ कुछ बार जगह की जानकारी के अपडेट मिल सकते हैं. बैकग्राउंड में लोकेशन की जानकारी ऐक्सेस करने की सीमाओं के बारे में ज़्यादा जानें.
अन्य संसाधन
बैकग्राउंड में जगह की जानकारी के इस्तेमाल के बारे में ज़्यादा जानने के लिए, यह कॉन्टेंट देखें:
वीडियो
बैकग्राउंड में जगह की जानकारी ऐक्सेस करने की सुविधा का इस्तेमाल करने वाले ऐप्लिकेशन का पता कैसे लगाएं
सैंपल
सैंपल
यह दिखाने के लिए कि ऐप्लिकेशन के बैकग्राउंड में होने पर, जगह की जानकारी को ऐक्सेस करने के सबसे सही तरीके क्या हैं.
इस पेज पर मौजूद कॉन्टेंट और कोड सैंपल कॉन्टेंट के लाइसेंस में बताए गए लाइसेंस के हिसाब से हैं. 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,["# Access location in the background\n\nAs described on the [request location\npermissions](/training/location/permissions) and [privacy best\npractices](/privacy/best-practices) pages, apps should only ask for the type of\nlocation permission that's critical to the user-facing feature, and properly\ndisclose this to users. The majority of use cases only require location when the\nuser is engaging with the app. If your app requires background location, such as\nwhen implementing geofencing, make sure that it's critical to the core\nfunctionality of the app, offers clear benefits to the user, and is done in a\nway that's obvious to them. \n**Note:** The Google Play store has updated its policy concerning device\nlocation, restricting background location access to apps that need it for\ntheir core functionality and meet related policy requirements. Adopting these\nbest practices doesn't guarantee Google Play approves your app's usage of\nlocation in the background.\n\nLearn more about the\n[policy\nchanges](https://support.google.com/googleplay/android-developer/answer/9799150) related to device location.\n\nBackground location access checklist\n------------------------------------\n\nUse the following checklist to identify potential location access logic in the\nbackground:\n\n- In your app's manifest, check for the\n [`ACCESS_COARSE_LOCATION` permission](/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION)\n and the\n [`ACCESS_FINE_LOCATION` permission](/reference/android/Manifest.permission#ACCESS_FINE_LOCATION).\n Verify that your app requires these location permissions.\n\n - If your app targets Android 10 (API level 29) or higher, also check for the [`ACCESS_BACKGROUND_LOCATION`\n permission](/training/location/receive-location-updates#request-background-location). Verify that your app has a feature that requires it.\n- Look for use of location access APIs, such as the [Fused Location Provider\n API](https://developers.google.com/location-context/fused-location-provider),\n [Geofencing API](https://developers.google.com/location-context/geofencing), or\n [LocationManager API](/reference/android/location/LocationManager), within your\n code such as in the following constructs:\n\n - [Background services](/training/run-background-service/create-service)\n - [`JobIntentService`](/reference/kotlin/androidx/core/app/JobIntentService) objects\n - [`WorkManager`](/reference/kotlin/androidx/work/WorkManager) or [`JobScheduler`](/reference/kotlin/android/app/job/JobScheduler) tasks\n - [`AlarmManager`](/reference/kotlin/android/app/AlarmManager) operations\n - Pending intents that are invoked from an [app\n widget](/guide/topics/appwidgets)\n- If your app uses an SDK or library that accesses location, this access is\n attributed to your app. To determine whether an SDK or library needs location\n access, consult the library's documentation.\n\nEvaluate background location access\n-----------------------------------\n\nIf you find that your app accesses location in the background, consider taking\nthe following actions:\n\n- Evaluate whether background location access is critical to the core functionality of the app.\n- If you don't need location access in the background, remove it.\n\n If your app targets Android 10 (API level 29) or higher, remove the\n [`ACCESS_BACKGROUND_LOCATION`\n permission](/training/location/receive-location-updates#request-background-location)\n from your app's manifest. When you remove this permission, all-the-time\n access to location isn't an option for the app on devices that run\n Android 10.\n- Make sure the user is aware that your app is accessing location in the\n background. This is especially important for cases that aren't obvious to users.\n\n- If possible, [refactor your location access\n logic](/about/versions/oreo/background-location-limits#tuning-behavior) so that\n you request location only when your app's activity is visible to users.\n\nLimited updates to background location\n--------------------------------------\n\nIf background location access is essential for your app, keep in mind that\nAndroid preserves device battery life by setting *background location\nlimits* on devices that run Android 8.0 (API level 26) and higher. On these\nversions of Android, if your app is running in the background, it can receive\nlocation updates only a few times each hour. Learn more about [background\nlocation limits](/about/versions/oreo/background-location-limits).\n\nAdditional resources\n--------------------\n\nTo learn more about background location usage, view the following materials:\n\n### Videos\n\n[How to find possible background location\nusage](https://www.youtube.com/watch?v=xTVeFJZQ28c)\n\n### Samples\n\n[Sample](https://github.com/android/platform-samples/tree/main/samples/location/src/main/java/com/example/platform/location/bglocationaccess)\nto demonstrate best practices for accessing location when app is in background."]]