백그라운드 위치 제한
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
Android 8.0 (API 수준 26)은 소비전력 절감을 위해 앱이 백그라운드에서 실행되는 동안 사용자의 현재 위치를 검색할 수 있는 빈도를 제한합니다. 이러한 조건에서는 앱이 시간당 몇 번만 위치 업데이트를 받을 수 있습니다.
참고: 이러한 제한은 앱의 타겟 SDK 버전과 상관없이 Android 8.0 (API 수준 26) 이상을 실행하는 기기에서 사용되는 모든 앱에 적용됩니다.
이 위치 검색 동작은 앱이 백그라운드에서 실행 중인 상태에서 실시간 경고나 모션 감지에 의존하는 경우 특히 유념해야 합니다.
포그라운드 앱 동작 유지
앱이 Android 8.0 (API 수준 26)을 실행 중인 기기의 포그라운드에 있는 경우 위치 업데이트 동작은 Android 7.1.1 (API 수준 25) 이하와 동일합니다.
경고: 앱이 오랜 기간에 걸쳐 거의 실시간 위치 업데이트를 검색하면 기기의 배터리 수명이 상당히 짧아지게 됩니다.
앱의 위치 동작 조정
앱이 위치 업데이트를 자주 받지 않는 경우에는 백그라운드에서 실행하기 위한 앱의 사용 사례가 전혀 성공할 수 없는지를 고려해야 합니다. 그런 경우라면 다음 작업 중 하나를 수행하여 위치 업데이트를 더 자주 검색할 수 있습니다.
- 앱을 포그라운드로 가져옵니다.
-
startForegroundService()
를 호출하여 앱에서 포그라운드 서비스를 시작합니다. 이러한 포그라운드 서비스가 활성 상태이면 알림 영역에 진행 중인 알림으로 표시됩니다.
주의: 앱이 Android 11 (API 수준 30) 이상을 실행하는 기기에서 백그라운드에서 실행되는 동안 포그라운드 서비스를 시작하는 경우 사용자가 앱에 ACCESS_BACKGROUND_LOCATION
권한을 부여하지 않는 한 앱은 위치 정보에 액세스할 수 없습니다. 자세한 내용은 포그라운드 서비스와 연결된 사용 중 제한사항에 관한 안내를 참고하세요.
-
GeofencingClient
와 같이, 전력 사용량 최소화를 위해 최적화된 Geofencing API 요소를 사용합니다.
-
빠른 속도로 위치를 요청하는 포그라운드 앱이 있는 경우 더 빠른 위치 업데이트를 받을 수 있는 수동적 위치 리스너를 사용합니다.
참고: 앱이 주기가 짧은 업데이트를 포함하는 위치 방문 기록에 액세스할 필요가 있는 경우 FusedLocationProviderApi
인터페이스와 같은 Fused Location Provider API 요소의 일괄 처리 버전을 사용하세요. 앱이 백그라운드에서 실행 중일 때 이 API는 비 일괄 처리 API보다 더 자주 사용자 위치 정보를 수신합니다. 하지만 앱은 여전히 시간당 몇 번만 일괄적으로 업데이트를 수신한다는 점에 유의해야 합니다.
관련 API
백그라운드 앱에서 위치 검색 동작의 변경사항은 다음 API에 영향을 미칩니다.
- Fused
Location Provider (FLP)
-
- 지오펜싱
-
- 백그라운드 앱은 Fused Location Provider의 업데이트보다 더 자주 지오펜싱 전환 이벤트를 수신할 수 있습니다.
- 지오펜싱 이벤트의 평균 응답성은 대략 몇 분 정도입니다.
- GNSS Measurements 및 GNSS Navigation Messages
-
- Location Manager
-
- Wi-Fi Manager
-
startScan()
메서드는 시간당 몇 번만 백그라운드 앱을 전체적으로 검색합니다. 뒤이어 곧 백그라운드 앱이 이 메서드를 다시 호출하면 WifiManager
클래스에서 이전 검색의 캐시된 결과를 제공합니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[null,null,["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# Background Location Limits\n\nIn an effort to reduce power consumption, Android 8.0 (API level 26) limits\nhow frequently an app can retrieve the user's current location while the app is\n[running in the background](/guide/background). Under these\nconditions, apps can receive location updates only a few times each hour.\n\n**Note:** These limitations apply to all apps used on devices\nrunning Android 8.0 (API level 26) or higher, **regardless of an app's\ntarget SDK version**.\n\nThis location retrieval behavior is particularly\nimportant to keep in mind if your app relies on real-time alerts or motion\ndetection while running in the background.\n\nForeground app behavior is preserved\n------------------------------------\n\n\nIf an app is in the foreground on a device running Android 8.0 (API level 26),\nthe location update behavior is the same as on Android 7.1.1 (API level\n25) and lower.\n\n**Warning:** If your app retrieves near real-time location\nupdates over a long period of time, the device's battery life becomes\nsignificantly shorter.\n\nTuning your app's location behavior\n-----------------------------------\n\nConsider whether your app's use cases for running in the background cannot\nsucceed at all if your app receives infrequent location updates. If this is the\ncase, you can retrieve location updates more frequently by performing one of the\nfollowing actions:\n\n- Bring your app to the foreground.\n- Start a [foreground\n service](/guide/components/foreground-services) in your app by calling\n [startForegroundService()](/reference/android/content/Context#startForegroundService(android.content.Intent)). When such a foreground service is active, it\n appears as an ongoing notification in the\n [notification\n area](/guide/topics/ui/notifiers/notifications).\n\n **Caution:** If your app starts a foreground service\n while running in the background on a device that runs Android 11 (API\n level 30) or higher, your app cannot access location information unless the\n user has granted the\n [`ACCESS_BACKGROUND_LOCATION`](/reference/android/Manifest.permission#ACCESS_BACKGROUND_LOCATION)\n permission to your app. For more information, view the guidance about the\n [while-in-use\n restrictions](/guide/components/foreground-services#while-in-use-restrictions) that are associated with foreground services.\n- Use elements of the Geofencing API, such as the [`GeofencingClient`](https://developers.google.com/android/reference/com/google/android/gms/location/GeofencingClient), which are optimized for minimizing power use.\n- Use a passive location listener, which may receive faster location updates if there are foreground apps requesting location updates at a faster rate.\n\n**Note:** If your app needs access to location history that\ncontains time-frequent updates, use the batched version of the Fused Location\nProvider API elements, such as the\n[`FusedLocationProviderApi`](https://developers.google.com/android/reference/com/google/android/gms/location/FusedLocationProviderApi)\ninterface. When your app is running in the background, this API receives the\nuser's location more frequently than the non-batched API. Keep in mind, however,\nthat your app still receives updates in batches only a few times each hour.\n\nAffected APIs\n-------------\n\n\nThe changes to location retrieval behavior in background apps affect the\nfollowing APIs:\n\n[Fused\nLocation Provider (FLP)](https://developers.google.com/android/reference/com/google/android/gms/location/FusedLocationProviderApi)\n:\n - If your app is running in the background, the location system service\n computes a new location for your app only a few times each hour. This\n is the case even when your app is requesting more frequent location\n updates.\n\n By using the\n [batched version](https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest#setMaxWaitTime(long)) of FLP, however, you have access to more\n time-frequent location history after your app receives a batch update,\n which also occurs only a few times each hour.\n - If your app is running in the foreground, there is no change in location sampling rates compared to Android 7.1.1 (API level 25).\n\nGeofencing\n:\n - Background apps can receive geofencing transition events more frequently than updates from the Fused Location Provider.\n - The average responsiveness for a geofencing event is every couple of minutes or so.\n\nGNSS Measurements and GNSS Navigation Messages\n:\n - When your app is in the background, callbacks that are registered to receive outputs from [GnssMeasurement](/reference/android/location/GnssMeasurement) and [GnssNavigationMessage](/reference/android/location/GnssNavigationMessage) stop executing.\n\nLocation Manager\n:\n - Location updates are provided to background apps only a few times\n each hour.\n\n\n **Note:** If your app is running on a device with\n Google Play services installed, it is highly recommended that you use\n the [Fused\n Location Provider (FLP)](https://developers.google.com/android/reference/com/google/android/gms/location/FusedLocationProviderApi) instead.\n\nWi-Fi Manager\n:\n The [startScan()](/reference/android/net/wifi/WifiManager#startScan()) method\n performs a full scan for background apps only a few times each hour. If a\n background app calls the method again soon afterward, the\n [WifiManager](/reference/android/net/wifi/WifiManager) class provides cached results from the\n previous scan."]]