[[["เข้าใจง่าย","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-26 UTC"],[],[],null,["# About background location and battery life\n\nBackground location usage can significantly impact battery life. Android\nsupports limits to background location gathering, prompting developers to\noptimize their applications for better battery efficiency. These optimizations\nare beneficial for all devices, regardless of the Android version they are\nrunning.\n\nWith [Background Location Limits](/about/versions/oreo/background-location-limits):\n\n- Background location gathering is throttled and location is computed, and delivered only a few times an hour.\n- Wi-Fi scans are more conservative, and location updates aren't computed when the device stays connected to the same static access point.\n- Geofencing responsiveness changes from tens of seconds to approximately two minutes. This change improves battery performance---up to 10 times better on some devices.\n\n| **Note:** These features were first introduced with Android 8.0 (API level 26).\n\nRequired knowledge\n------------------\n\nThis document assumes familiarity with the following APIs:\n\n- [Google Location Services.](https://developers.google.com/android/reference/com/google/android/gms/location/package-summary.html) These APIs offer higher accuracy and impose a lighter battery burden than the [framework location APIs](/reference/android/location/package-summary).\n- [Fused Location Provider.](https://developers.google.com/location-context/fused-location-provider/) This API combines signals from GPS, Wi-Fi, and cell networks, as well as accelerometer, gyroscope, magnetometer and other sensors.\n- [Geofencing](https://developers.google.com/location-context/geofencing/), This API is built on top of the Fused Location Provider API, and is optimized for battery performance.\n\nUnderstand battery drain\n------------------------\n\nLocation gathering and battery drain are related as follows:\n\n- **Accuracy:** The precision of the location data. In general, the higher the accuracy, the higher the battery drain.\n- **Frequency:** How often location is computed. The more frequent location is computed, the more battery is used.\n- **Latency:** How quickly location data is delivered. Less latency usually requires more battery.\n\n### Accuracy\n\nYou can specify location accuracy using the [`setPriority()`](https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest.Builder#public-locationrequest.builder-setpriority-int-priority) method, passing\none of the following values as the argument:\n\n- [`PRIORITY_HIGH_ACCURACY`](https://developers.google.com/android/reference/com/google/android/gms/location/Priority#public-static-final-int-priority_high_accuracy) provides the most accurate location possible, which is computed using as many inputs as necessary (it enables GPS, Wi-Fi, and cell, and uses a variety of [Sensors](/guide/topics/sensors/sensors_overview)), and may cause significant battery drain.\n- [`PRIORITY_BALANCED_POWER_ACCURACY`](https://developers.google.com/android/reference/com/google/android/gms/location/Priority#public-static-final-int-priority_balanced_power_accuracy) provides accurate location while optimizing for power. Very rarely uses GPS. Typically uses a combination of Wi-Fi and cell information to compute device location.\n- [`PRIORITY_LOW_POWER`](https://developers.google.com/android/reference/com/google/android/gms/location/Priority#public-static-final-int-priority_low_power) largely relies on cell towers and avoids GPS and Wi-Fi inputs, providing coarse (city-level) accuracy with minimal battery drain.\n- [`PRIORITY_NO_POWER`](https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest.html#PRIORITY_NO_POWER) receives locations passively from other apps for which location has already been computed.\n\nUse the balanced power or low power options to satisfy the location needs of\nmost apps. Reserve high accuracy for apps that run in the foreground and require\n*real time* location updates (for example, a mapping app).\n\n### Frequency\n\nYou can specify location frequency using two methods:\n\n- Use the [`setIntervalMillis()`](https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest.Builder#public-locationrequest.builder-setintervalmillis-long-intervalmillis) method to specify the interval for computing your app's location.\n- Use the [`setMinUpdateIntervalMillis()`](https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest.Builder#public-locationrequest.builder-setminupdateintervalmillis-long-minupdateintervalmillis) method to specify the interval for receiving other apps' locations.\n\nPass the largest possible value when using `setIntervalMillis()`. This is\nespecially true for background location gathering, which often drains the\nbattery. Reserve intervals of a few seconds for foreground use cases.\n\nThe background location limits introduced in Android 8.0 (API level 26) enforce\nthese strategies, but your app should strive to enforce them on devices running\nAndroid 7.0 (API level 24) and lower.\n\n### Latency\n\nYou can specify latency using the [`setMaxUpdateDelayMillis()`](https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest.Builder#public-locationrequest.builder-setmaxupdatedelaymillis-long-maxupdatedelaymillis) method,\ntypically passing a value that is several times larger than the interval\nspecified in the [`setIntervalMillis()`](https://developers.google.com/android/reference/com/google/android/gms/location/LocationRequest.Builder#public-locationrequest.builder-setintervalmillis-long-intervalmillis) method. This setting delays\nlocation delivery, and multiple location updates may be delivered in batches.\nThese two changes help minimize battery consumption.\n\nIf your app doesn't immediately need a location update, you should pass the\nlargest possible value to the `setMaxUpdateDelayMillis()` method, effectively\ntrading latency for more data and battery efficiency.\n\nWhen using geofences, apps should pass a large value into the\n[`setNotificationResponsiveness()`](https://developers.google.com/android/reference/com/google/android/gms/location/Geofence.Builder.html#setNotificationResponsiveness(int)) method to preserve power. A value of\nfive minutes or larger is recommended.\n\nFurther reading\n---------------\n\nFor more information, see the following documents:\n\n- [Recommendations](/develop/sensors-and-location/location/battery/optimize): This guide lays out some concrete recommended actions you can use to improve your app's impact on battery life.\n- [Use cases](/develop/sensors-and-location/location/battery/scenarios): This guide provides several common use cases where you might use location services and how you could optimise the impact on battery life for those cases."]]