Im Hintergrund auf Standort zugreifen
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Wie auf der Seite Berechtigungen zur Standortermittlung anfordern und in den Best Practices zum Datenschutz beschrieben, sollten Apps nur nach der Art der Berechtigung zur Standortermittlung fragen, die für die für Nutzer sichtbare Funktion erforderlich ist, und Nutzern dies ordnungsgemäß mitteilen. In den meisten Anwendungsfällen wird der Standort nur dann benötigt, wenn der Nutzer mit der App interagiert. Wenn für deine App die Standortermittlung im Hintergrund erforderlich ist, z. B. bei der Implementierung von Geofencing, muss dies für die Hauptfunktion der App entscheidend sein, klare Vorteile für den Nutzer bieten und auf eine für sie offensichtliche Weise erfolgen.
Hinweis:Für den Google Play Store wurde die Richtlinie zum Gerätestandort aktualisiert. Dadurch wird der Zugriff auf die Standortermittlung im Hintergrund auf Apps beschränkt, die die Standortermittlung für ihre Hauptfunktionen benötigen und die damit verbundenen Richtlinienanforderungen erfüllen. Die Einhaltung dieser Best Practices ist jedoch keine Garantie dafür, dass Google Play die Verwendung der Standortermittlung im Hintergrund durch deine App genehmigt.
Weitere Informationen zu den Richtlinienänderungen in Bezug auf den Gerätestandort
Checkliste für den Zugriff auf die Standortermittlung im Hintergrund
Anhand der folgenden Checkliste kannst du im Hintergrund potenzielle Standortzugriffslogik ermitteln:
Prüfen Sie im Manifest Ihrer App, ob die Berechtigungen ACCESS_COARSE_LOCATION
und die Berechtigung ACCESS_FINE_LOCATION
vorhanden sind.
Überprüfe, ob deine App diese Berechtigungen zur Standortermittlung benötigt.
- Wenn deine App auf Android 10 (API-Level 29) oder höher ausgerichtet ist, solltest du auch prüfen, ob die Berechtigung
ACCESS_BACKGROUND_LOCATION
vorliegt.
Prüfen Sie, ob Ihre App eine Funktion hat, für die sie erforderlich ist.
Suchen Sie in Ihrem Code nach Verwendung von Standortzugriffs-APIs, z. B. Fused Location Provider API, Geofencing API oder LocationManager API. Beispiel:
Wenn Ihre App ein SDK oder eine Bibliothek verwendet, die auf den Standort zugreift, wird dieser Zugriff Ihrer App zugeordnet. Ob ein SDK oder eine Bibliothek Standortzugriff benötigt, können Sie in der Dokumentation der Bibliothek nachlesen.
Zugriff auf die Standortermittlung im Hintergrund bewerten
Wenn Ihre App im Hintergrund auf die Standortermittlung zugreift, sollten Sie Folgendes tun:
- Bewerten Sie, ob der Zugriff auf die Standortermittlung im Hintergrund für die Hauptfunktion der App wichtig ist.
Wenn Sie den Standortzugriff im Hintergrund nicht benötigen, entfernen Sie ihn.
Wenn deine App auf Android 10 (API-Level 29) oder höher ausgerichtet ist, entferne die Berechtigung ACCESS_BACKGROUND_LOCATION
aus dem Manifest deiner App. Wenn du diese Berechtigung entfernst, kann die App auf Geräten mit Android 10 nicht dauerhaft auf den Standort zugreifen.
Nutzer muss wissen, dass die App im Hintergrund auf die Standortermittlung zugreift. Das ist besonders wichtig in Fällen, die für Nutzer nicht offensichtlich sind.
Refaktorieren Sie nach Möglichkeit die Logik für den Standortzugriff, sodass der Standort nur dann angefordert wird, wenn die App-Aktivitäten für Nutzer sichtbar sind.
Begrenzte Aktualisierung der Standortermittlung im Hintergrund
Wenn der Zugriff auf die Standortermittlung im Hintergrund für Ihre App erforderlich ist, bedenken Sie, dass Android die Akkulaufzeit Ihres Geräts verlängert, indem auf Geräten mit Android 8.0 (API-Level 26) und höher Limits für die Standortermittlung im Hintergrund festgelegt werden. Wenn Ihre App unter diesen Android-Versionen im Hintergrund ausgeführt wird, kann sie nur einige Male pro Stunde Standortaktualisierungen empfangen. Weitere Informationen zu Limits für die Standortermittlung im Hintergrund
Weitere Informationen
Weitere Informationen zur Verwendung der Standortermittlung im Hintergrund finden Sie in den folgenden Materialien:
Videos
Mögliche Nutzung der Standortermittlung im Hintergrund
Produktproben
Beispiel zur Veranschaulichung der Best Practices für den Zugriff auf den Standort, wenn die App im Hintergrund ausgeführt wird
Alle Inhalte und Codebeispiele auf dieser Seite unterliegen den Lizenzen wie im Abschnitt Inhaltslizenz beschrieben. Java und OpenJDK sind Marken oder eingetragene Marken von Oracle und/oder seinen Tochtergesellschaften.
Zuletzt aktualisiert: 2025-07-27 (UTC).
[null,null,["Zuletzt aktualisiert: 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."]]