আপনার অ্যাপের টার্গেট SDK সংস্করণের উপর ভিত্তি করে অনুরোধটি কীভাবে পরিচালনা করবেন।
আনুমানিক অবস্থানের জন্য ব্যবহারকারীর পছন্দগুলি কীভাবে আপনার অ্যাপের ব্যাকগ্রাউন্ড লোকেশন পায় তা প্রভাবিত করে।
চিত্র 7. সেটিংস পৃষ্ঠায় সব সময় অনুমতি দিন নামক একটি বিকল্প রয়েছে, যা ব্যাকগ্রাউন্ড অবস্থান অ্যাক্সেস মঞ্জুর করে।
অনুমতি ডায়ালগের বিষয়বস্তু টার্গেট SDK সংস্করণের উপর নির্ভর করে
যখন আপনার অ্যাপের কোনো বৈশিষ্ট্য Android 10 (API লেভেল 29) চালিত কোনো ডিভাইসে ব্যাকগ্রাউন্ড লোকেশনের জন্য অনুরোধ করে, তখন সিস্টেম পারমিশন ডায়ালগে Allow all time নামে একটি বিকল্প থাকে। ব্যবহারকারী এই বিকল্পটি নির্বাচন করলে, আপনার অ্যাপের বৈশিষ্ট্যটি ব্যাকগ্রাউন্ড অবস্থান অ্যাক্সেস লাভ করে।
অ্যান্ড্রয়েড 11 (এপিআই লেভেল 30) এবং উচ্চতর, তবে, সিস্টেম ডায়ালগে সব সময় অনুমতি দেওয়ার বিকল্পটি অন্তর্ভুক্ত নয়। পরিবর্তে, ব্যবহারকারীদের অবশ্যই একটি সেটিংস পৃষ্ঠায় পটভূমি অবস্থান সক্ষম করতে হবে, যেমন চিত্র 7 এ দেখানো হয়েছে।
আপনি ব্যাকগ্রাউন্ড অবস্থানের অনুমতির অনুরোধ করার সময় সেরা অনুশীলনগুলি অনুসরণ করে ব্যবহারকারীদের এই সেটিংস পৃষ্ঠাতে নেভিগেট করতে সহায়তা করতে পারেন। অনুমতি দেওয়ার প্রক্রিয়াটি আপনার অ্যাপের টার্গেট SDK সংস্করণের উপর নির্ভর করে।
অ্যাপ্লিকেশান Android 11 বা উচ্চতরকে লক্ষ্য করে
যদি আপনার অ্যাপটিকে ACCESS_BACKGROUND_LOCATION অনুমতি না দেওয়া হয়, এবং shouldShowRequestPermissionRationale()true দেখায়, তাহলে নিম্নলিখিতগুলি অন্তর্ভুক্ত করে এমন ব্যবহারকারীদের একটি শিক্ষামূলক UI দেখান:
কেন আপনার অ্যাপের বৈশিষ্ট্যটির ব্যাকগ্রাউন্ড অবস্থানে অ্যাক্সেস প্রয়োজন তার একটি স্পষ্ট ব্যাখ্যা।
সেটিংস বিকল্পের ব্যবহারকারীর-দৃশ্যমান লেবেল যা পটভূমির অবস্থান মঞ্জুর করে (উদাহরণস্বরূপ, চিত্র 7-এ সব সময় অনুমতি দিন )। আপনি এই লেবেল পেতে getBackgroundPermissionOptionLabel() কল করতে পারেন। এই পদ্ধতির রিটার্ন মান ব্যবহারকারীর ডিভাইস ভাষা পছন্দ স্থানীয়করণ করা হয়.
ব্যবহারকারীদের অনুমতি প্রত্যাখ্যান করার জন্য একটি বিকল্প। ব্যবহারকারীরা ব্যাকগ্রাউন্ড লোকেশন অ্যাক্সেস প্রত্যাখ্যান করলে, তারা আপনার অ্যাপ ব্যবহার চালিয়ে যেতে সক্ষম হবেন।
চিত্র 8. বিজ্ঞপ্তি ব্যবহারকারীকে মনে করিয়ে দেয় যে তারা একটি অ্যাপে ব্যাকগ্রাউন্ড অবস্থান অ্যাক্সেস মঞ্জুর করেছে।
অ্যাপটি লক্ষ্য করে Android 10 বা তার চেয়ে কম
যখন আপনার অ্যাপের একটি বৈশিষ্ট্য ব্যাকগ্রাউন্ড লোকেশন অ্যাক্সেসের অনুরোধ করে, ব্যবহারকারীরা একটি সিস্টেম ডায়ালগ দেখতে পান। এই ডায়ালগে সেটিংস পৃষ্ঠায় আপনার অ্যাপের অবস্থানের অনুমতি বিকল্পগুলিতে নেভিগেট করার একটি বিকল্প রয়েছে৷
যতক্ষণ না আপনার অ্যাপ ইতিমধ্যেই অবস্থানের অনুমতির অনুরোধ করার জন্য সর্বোত্তম অনুশীলনগুলি অনুসরণ করে, ততক্ষণ আপনাকে এই আচরণকে সমর্থন করার জন্য কোনো পরিবর্তন করতে হবে না।
ব্যবহারকারী পটভূমি অবস্থান নির্ভুলতা প্রভাবিত করতে পারেন
যদি ব্যবহারকারী আনুমানিক অবস্থানের জন্য অনুরোধ করে , তাহলে অবস্থান অনুমতি ডায়ালগে ব্যবহারকারীর পছন্দগুলিও পটভূমি অবস্থানের ক্ষেত্রে প্রযোজ্য। অন্য কথায়, যদি ব্যবহারকারী আপনার অ্যাপটিকে ACCESS_BACKGROUND_LOCATION অনুমতি দেয় কিন্তু অগ্রভাগে শুধুমাত্র আনুমানিক অবস্থানের অ্যাক্সেস দেয়, তবে আপনার অ্যাপটির ব্যাকগ্রাউন্ডেও শুধুমাত্র আনুমানিক অবস্থান অ্যাক্সেস রয়েছে।
অতিরিক্ত সম্পদ
অ্যান্ড্রয়েডে অবস্থানের অনুমতি সম্পর্কে আরও তথ্যের জন্য, নিম্নলিখিত উপকরণগুলি দেখুন:
অবস্থানের অনুমতির ব্যবহার প্রদর্শনের জন্য নমুনা অ্যাপ ।
এই পৃষ্ঠার কন্টেন্ট ও কোডের নমুনাগুলি Content License-এ বর্ণিত লাইসেন্সের অধীনস্থ। Java এবং OpenJDK হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-08-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-08-27 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["This page discusses the following:\n\n- How to request background location access.\n- How to handle the request based on your app's target SDK version.\n- How user preferences for approximate location affect how your app gets background location.\n\n**Note:** If a feature in your app accesses location from the background, verify that access is necessary. Consider getting the information that the feature needs in other ways. To learn more about background location access, see the [Access location in the background](/training/location/background) page. \n**Figure 7.** Settings page includes an option called **Allow all the time**, which grants background location access.\n\nPermission dialog contents depend on target SDK version\n\nWhen a feature in your app requests background location on a device that runs\nAndroid 10 (API level 29), the system permissions dialog includes an option\nnamed **Allow all the time**. If the user selects this option, the feature in\nyour app gains background location access.\n\nOn Android 11 (API level 30) and higher, however, the system dialog doesn't\ninclude the **Allow all the time** option. Instead, users must enable background\nlocation on a settings page, as shown in figure 7.\n\nYou can help users navigate to this settings page by following best practices\nwhen requesting the background location permission. The process for granting the\npermission depends on your app's target SDK version.\n\nApp targets Android 11 or higher\n\nIf your app hasn't been granted the `ACCESS_BACKGROUND_LOCATION` permission, and\n[`shouldShowRequestPermissionRationale()`](/reference/androidx/core/app/ActivityCompat#shouldShowRequestPermissionRationale(android.app.Activity,%20java.lang.String)) returns `true`, show an\neducational UI to users that includes the following:\n\n- A clear explanation of why your app's feature needs access to background location.\n- The user-visible label of the settings option that grants background location (for example, **Allow all the time** in figure 7). You can call [`getBackgroundPermissionOptionLabel()`](/reference/android/content/pm/PackageManager#getBackgroundPermissionOptionLabel()) to get this label. The return value of this method is localized to the user's device language preference.\n- An option for users to decline the permission. If users decline background location access, they should be able to continue using your app.\n\n**Figure 8.**Notification reminding the user that they've granted background location access to an app.\n\nApp targets Android 10 or lower\n\nWhen a feature in your app requests background location access, users see a\nsystem dialog. This dialog includes an option to navigate to your app's location\npermission options on a settings page.\n\nAs long as your app already follows best practices for requesting location\npermissions, you don't need to make any changes to support this behavior.\n\nUser can affect background location accuracy\n\nIf the [user requests approximate location](/develop/sensors-and-location/location/permissions/runtime#approximate-request), the user's choices in the\nlocation permissions dialog also apply to background location. In other words,\nif the user grants your app the `ACCESS_BACKGROUND_LOCATION` permission but\ngrants only approximate location access in the foreground, your app has only\napproximate location access in the background as well.\n\nAdditional resources\n\nFor more information about location permissions in Android, view the following\nmaterials:\n\nCodelabs\n\n- [Privacy best practices](/codelabs/android-privacy-codelab)\n\nVideos\n\n- [How to find possible background location usage](https://www.youtube.com/watch?v=xTVeFJZQ28c)\n\nSamples\n\n- [Sample app](https://github.com/android/platform-samples/tree/main/samples/location/src/main/java/com/example/platform/location/permission) to demonstrate the use of location permissions."]]