[null,null,["最后更新时间 (UTC):2025-08-21。"],[],[],null,["# Location updates in Android 11\n\nTo further protect user privacy, Android 11 adds one-time\nlocation access and changes how users grant background location access. These\nupdates affect all apps that run on Android 11 and higher.\n\nOne-time access\n---------------\n\n**Figure 1.** System dialog for the foreground location permission includes an option called **Only this time**.\n\nOn Android 11 and higher, whenever your app requests access to\n[foreground location](/training/location/permissions#foreground), the system\npermissions dialog includes an option called **Only this time**, as shown in\nfigure 1. This option give users more control over when an app can access\nlocation information.\n\nLearn more about how the system handles [one-time\npermissions](/guide/topics/permissions/overview#one-time).\n\nBackground location access\n--------------------------\n\nAndroid 11 changes how a feature in your app can gain access to\n[background location](/training/location/permissions#background). This section\ndescribes each of these changes.\n\nIf a feature in your app accesses location from the background, verify that such\naccess is necessary. Consider getting the information that the feature needs in\nother ways, as described on the page about how to [access\nlocation in the background](/training/location/background).\n\n### Request background location separately\n\nAs described in the guide on how to [request location access at\nruntime](/training/location/permissions#request-location-access-runtime), you\nshould perform incremental location requests. If your app targets\nAndroid 11 or higher, the system enforces this best practice. If\nyou request a foreground location permission and the background location\npermission at the same time, the system ignores the request and doesn't grant\nyour app either permission.\n\n### Permission dialog changes\n\n### Change details\n\n**Change Name** : `BACKGROUND_RATIONALE_CHANGE_ID`\n\n**Change ID** : `147316723`\n\n### How to toggle\n\nAs you test your app's compatibility with Android 11, you can toggle this change on or off\nusing the following ADB commands: \n\n adb shell am compat enable (\u003cvar translate=\"no\"\u003e147316723\u003c/var\u003e|\u003cvar translate=\"no\"\u003eBACKGROUND_RATIONALE_CHANGE_ID\u003c/var\u003e) \u003cvar translate=\"no\"\u003ePACKAGE_NAME\u003c/var\u003e\n adb shell am compat disable (\u003cvar translate=\"no\"\u003e147316723\u003c/var\u003e|\u003cvar translate=\"no\"\u003eBACKGROUND_RATIONALE_CHANGE_ID\u003c/var\u003e) \u003cvar translate=\"no\"\u003ePACKAGE_NAME\u003c/var\u003e\n\nFor more information about the compatibility framework and toggling changes, see\n[Test and debug platform behavior changes in\nyour app](/guide/app-compatibility/test-debug).\n\nWhen a feature in your app requests background location on a device that runs\nAndroid 11 or higher, the system dialog doesn't include a button\nto enable background location access. In order to enable background location\naccess, users must set the **Allow all the time** option for your app's location\npermission on a settings page, as described in the guide on how to [Request\nbackground location](/training/location/permissions#request-background-location).\n\n### Additional resources\n\nFor more information about accessing background location, view the following\nmaterials:\n\n#### Videos\n\n- [How to find possible background location\n usage](https://www.youtube.com/watch?v=xTVeFJZQ28c)"]]